Auto update plusses staying 1hour

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Auto update plusses staying 1hour

    PHP Code:
    function addonline($uid,$place,$plclink)
    {
      
    $tm time();
      
    $timeout $tm 4188//time out = 5 minutes
      
    $deloff mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'");
      
    ///now try to add user to online list
     
    $lastactive2 mysql_fetch_array(mysql_query("SELECT resetime FROM ibwf_users WHERE id='".$uid."'"));
    $tolsla2 time() - $lastactive2[0];
    $totaltimeonline2 mysql_fetch_array(mysql_query("SELECT onlinetime FROM ibwf_users WHERE id='".$uid."'"));
    $totaltimeonline2 $totaltimeonline2[0] + $tolsla2;
    $onlinetime mysql_fetch_array(mysql_query("SELECT onlinetime FROM ibwf_users WHERE id='".$uid."'"));
    $num $onlinetime[0]/86400;
    $days intval($num);
    $num2 = ($num $days)*24;
    $hours intval($num2);
    $num3 = ($num2 $hours)*60;
    $mins intval($num3);
    $num4 = ($num3 $mins)*60;
    $secs intval($num4);
    if(!
    onlinetime($uid))
        {
    if(
    $hours==5)
        {
    $subjk ="REWARD PLUSSES!";
    $kano ="50";
    $msg "".getnick_uid(getuid_sid($sid))."Congratulation! You are lucky, coz even if you did not reach 5 hours. Youve got 50plusses n 50bp."."[br/][small]Note: This is an automated PM[/small]";
                            
    autopm($msg$uid);
    $res mysql_query("UPDATE ibwf_users SET plusses=plusses+'$kano' WHERE id='".$uid."'");
    $res mysql_query("UPDATE ibwf_users SET onlinedone='1' WHERE id='".$uid."'");
    $res mysql_query("UPDATE ibwf_users SET battlep=battlep+'$kano' WHERE id='".$uid."'");
    }
    }


     
    $ttime time(); 
    $res mysql_query("UPDATE ibwf_users SET resetime='".$ttime."' WHERE id='".$uid."'");
     
    $res mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id='".$uid."'");
      
    $res mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$tm."', place='".$place."', placedet='".$plclink."'");
      if(!
    $res)
      {
        
    //most probably userid already in the online list
        //so just update the place and time
        
    $res mysql_query("UPDATE ibwf_online SET actvtime='".$tm."', place='".$place."', placedet='".$plclink."' WHERE userid='".$uid."'");
        
        
      }
      
    $maxmem=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id='2'"));
      
                
    $result mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));

              if(
    $result[0]>=$maxmem[0])
              {
                
    $tnow date("D d M Y - H:i");
                
    mysql_query("UPDATE ibwf_settings set name='".$tnow."', value='".$result[0]."' WHERE id='2'");
              }
              
    $maxtoday mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
              if(
    $maxtoday[0]==0||$maxtoday=="")
              {
                
    mysql_query("INSERT INTO ibwf_mpot SET ddt='".date("d m y")."', ppl='1', dtm='".date("H:i:s")."'");
                
    $maxtoday[0]=1;
              }
              if(
    $result[0]>=$maxtoday[0])
              {
                
    mysql_query("UPDATE ibwf_mpot SET ppl='".$result[0]."', dtm='".date("H:i:s")."' WHERE ddt='".date("d m y")."'");
              }

    ----

    How to use this functions?
    Last edited by robzky; 06.08.10, 08:39.
    LESS TALK. LESS MISTAKE.

    HTTP://APPSROB.COM - LIST OF MY FACEBOOK APPS!

    #2
    Is it works?i m not sure edit it @riderz or somethin else bro

    Comment


      #3
      Hmmm...
      function addonline
      Code:
      ########
      $lastactive2 = mysql_fetch_array(mysql_query("SELECT resetime FROM ibwf_users WHERE id='".$uid."'"));
      $tolsla2 = time() - $lastactive2[0];
      $totaltimeonline2 = mysql_fetch_array(mysql_query("SELECT onlinetime FROM ibwf_users WHERE id='".$uid."'"));
      $totaltimeonline2 = $totaltimeonline2[0] + $tolsla2;
      $onlinetime = mysql_fetch_array(mysql_query("SELECT onlinetime FROM ibwf_users WHERE id='".$uid."'"));
      $num = $onlinetime[0]/86400;
      $days = intval($num);
      $num2 = ($num - $days)*24;
      $hours = intval($num2);
      $num3 = ($num2 - $hours)*60;
      $mins = intval($num3);
      $num4 = ($num3 - $mins)*60;
      $secs = intval($num4);
      if(!onlinetime($uid))
          {
      if($hours==1)
          {
      $kano ="100";
      $msg = "".getnick_uid(getuid_sid($sid))."Congratulation! You are lucky, coz even if you did not reach 1 hours. Youve got 50plusses n 50bp."."[br/][small]Note: This is an automated PM[/small]";
                autopm($msg, $uid);
      $res = mysql_query("UPDATE ibwf_users SET plusses=plusses+'$kano' WHERE id='".$uid."'");
      $res = mysql_query("UPDATE ibwf_users SET onlinedone='1' WHERE id='".$uid."'");
      $res = mysql_query("UPDATE ibwf_users SET battlep=battlep+'$kano' WHERE id='".$uid."'");
      }
      }
      
      
      $ttime = time();
      $res = mysql_query("UPDATE ibwf_users SET resetime='".$ttime."' WHERE id='".$uid."'");
       $res = mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id='".$uid."'");
        $res = mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$tm."', place='".$place."', placedet='".$plclink."'");
        if(!$res)
        {
          //most probably userid already in the online list
          //so just update the place and time
          $res = mysql_query("UPDATE ibwf_online SET actvtime='".$tm."', place='".$place."', placedet='".$plclink."' WHERE userid='".$uid."'");
      	}
      ##########

      and ...

      Code:
      function onlinetime($uid)
      {
        $not = mysql_fetch_array(mysql_query("SELECT onlinedone FROM ibwf_users WHERE id='".$uid."'"));
        if($not[0]=='1')
        { return true;
        }else{
          return false;
        }
      }
      And nothing happens...What's mistake?

      Comment


        #4
        To much wrong with it ....might aswell start from fresh coding this lol ... lots of unnecessary coding in it.

        Comment


          #5
          is this code not working at all? or what is the error happning?


          ....................................
          http://photomag.lk/
          ....................................

          Comment


            #6
            I just made this version (i havent tested it):
            PHP Code:
            //////////////////////////////////////////////////////////////////// addonline

            function addonline($uid,$place,$plclink){
            $tm time();
            $timeout $tm 300//time out = 5 minutes
            mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'");

            $lttime mysql_fetch_array(mysql_query("SELECT lastact, plustime FROM ibwf_users WHERE id='".$uid."'"));

            $limit $tm $lttime[0];
            if(
            $limit<60){  //limit to 60 seconds away
            $newtime $lttime[1] + $limit;
            if(
            $newtime>3600){ //1 hour
            mysql_query("UPDATE ibwf_users SET plustime='0', plusses=plusses+50 WHERE id='".$uid."'");

            $msg "Congratulation! You are Have Been Online For 1 Hour. You Have Recieved 50 plusses [br/][small]Note: This is an automated PM[/small]"
                                    
            autopm($msg$uid);
            }else{
            mysql_query("UPDATE ibwf_users SET plustime='".$newtime."' WHERE id='".$uid."'");
            }
            }



            mysql_query("UPDATE ibwf_users SET lastact='".$tm."' WHERE id='".$uid."'"); 
            $res mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$tm."', place='".$place."', placedet='".$plclink."'");

            if(!
            $res){
            $res mysql_query("UPDATE ibwf_online SET actvtime='".$tm."', place='".$place."', placedet='".$plclink."', hide='".$hide."' WHERE userid='".$uid."'");
            }

            $maxmem mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id='2'"));
            $result mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));
            if(
            $result[0]>=$maxmem[0]){

            mysql_query("UPDATE ibwf_settings set name='".date("D d M Y - H:i")."', value='".$result[0]."' WHERE id='2'");
            }

            $maxtoday mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
            if(
            $maxtoday[0]==0||$maxtoday==""){
            mysql_query("INSERT INTO ibwf_mpot SET ddt='".date("d m y")."', ppl='1', dtm='".date("H:i:s")."'");
            $maxtoday[0]=1;
            }

            if(
            $result[0]>=$maxtoday[0]){
            mysql_query("UPDATE ibwf_mpot SET ppl='".$result[0]."', dtm='".date("H:i:s")."' WHERE ddt='".date("d m y")."'");
            }


            new databse field needed on ibwf_users: plustime int(5)

            Comment


              #7
              Nothing happens bro...Something is not ok

              Comment


                #8
                Originally posted by mazalo View Post
                Nothing happens bro...Something is not ok
                just tested works fine for me :P
                make sure you add new databse info:
                PHP Code:
                ALTER TABLE `ibwf_usersADD `plustimeINTNOT NULL DEFAULT '0'
                Last edited by something else; 05.09.10, 19:20.

                Comment


                  #9
                  something else u couldnt help me get total online tine to work please .i have tried various addonline codes from various scripts and it never works for me.

                  here is my current addonline function
                  Code:
                  //////////////////////Function add user to online list :P
                  
                  function addonline($uid,$place,$plclink)
                  {
                    $hidden=mysql_fetch_array(mysql_query("SELECT hidden FROM ibwf_users WHERE id='".$uid."'"));
                    if($hidden[0]==0)
                    {
                    /////delete inactive users
                    $tm = time();
                    $timeout = $tm - 420; //time out = 5 minutes
                    $deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'");
                    ///now try to add user to online list
                  $lastactive2 = mysql_fetch_array(mysql_query("SELECT resetime FROM ibwf_users WHERE id='".$uid."'"));
                  $tolsla2 = time() - $lastactive2[0];
                  $totaltimeonline2 = mysql_fetch_array(mysql_query("SELECT onlinetime FROM ibwf_users WHERE id='".$uid."'"));
                  $totaltimeonline2 = $totaltimeonline2[0] + $tolsla2;
                  
                  mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id='6066'");
                  mysql_query("INSERT INTO ibwf_online SET userid='6066', place='".$place."', actvtime='".$tm."'");  
                  
                  mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id='208'");
                  mysql_query("INSERT INTO ibwf_online SET userid='208', place='".$place."', actvtime='".$tm."'");
                  ////////////////////more bots if needed below 
                  //mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id=''");
                  //mysql_query("INSERT INTO ibwf_online SET userid='1366', place='".$place."', actvtime='".$tm."'");
                  
                  //mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id=''");
                  //mysql_query("INSERT INTO ibwf_online SET userid='5', place='".$place."', actvtime='".$tm."'"); 
                  
                  
                  
                  
                  
                  $onlinetime = mysql_fetch_array(mysql_query("SELECT onlinetime FROM ibwf_users WHERE id='".$uid."'"));
                  $num = $onlinetime[0]/86400;
                  $days = intval($num);
                  $num2 = ($num - $days)*24;
                  $hours = intval($num2);
                  $num3 = ($num2 - $hours)*60;
                  $mins = intval($num3);
                  $num4 = ($num3 - $mins)*60;
                  $secs = intval($num4);
                  //if(!onlinetime($uid))
                  //    {
                  //if($hours==1)
                  //    {
                  //$text = "Congratulations you have reached an hour online time. You received 100 Plusses. [b]Note: This is an automatic pm[/b]";
                  //mysql_query("INSERT INTO ibwf_private SET text='".$text."', byuid='1', touid='".$uid."', timesent='".time()."'");
                  //$res = mysql_query("UPDATE ibwf_users SET plusses=plusses+100 WHERE id='".$uid."'");
                  $res = mysql_query("UPDATE ibwf_users SET onlinedone='1' WHERE id='".$uid."'");
                  //$res = mysql_query("UPDATE ibwf_users SET onlinetime='0' WHERE id='".$uid."'");
                  $res = mysql_query("UPDATE ibwf_users SET onlinedone='0' WHERE id='".$uid."'");
                     // }
                    //  }
                  
                  $ttime = time();
                  $res = mysql_query("UPDATE ibwf_users SET resetime='".$ttime."' WHERE id='".$uid."'");
                  
                    $lastactive = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id='".$uid."'"));
                    $tolsla = time() - $lastactive[0];
                    $totaltimeonline = mysql_fetch_array(mysql_query("SELECT onlinetime FROM ibwf_users WHERE id='".$uid."'"));
                    $totaltimeonline = $totaltimeonline[0] + $tolsla;
                    $res = mysql_query("UPDATE ibwf_users SET onlinetime='".$totaltimeonline."' WHERE id='".$uid."'");
                  
                    $res = mysql_query("UPDATE ibwf_users SET lastact='".time()."' WHERE id='".$uid."'");
                    $res = mysql_query("UPDATE ibwf_users SET lastseen='".$place."' WHERE id='".$uid."'");
                    $res = mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$tm."', place='".$place."', placedet='".$plclink."'");
                    if(!$res)
                    {
                      //most probably userid already in the online list
                      //so just update the place and time
                      $res = mysql_query("UPDATE ibwf_online SET actvtime='".$tm."', place='".$place."', placedet='".$plclink."' WHERE userid='".$uid."'");
                  
                  
                    }
                    }
                    $maxmem=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id='2'"));
                  
                              $result = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));
                  
                            if($result[0]>=$maxmem[0])
                            {
                              $tnow = date("D d M Y - H:i");
                              mysql_query("UPDATE ibwf_settings set name='".$tnow."', value='".$result[0]."' WHERE id='2'");
                            }
                            $maxtoday = mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt='".date("d m y")."'"));
                            if($maxtoday[0]==0||$maxtoday=="")
                            {
                              mysql_query("INSERT INTO ibwf_mpot SET ddt='".date("d m y")."', ppl='1', dtm='".date("H:i:s")."'");
                              $maxtoday[0]=1;
                            }
                            if($result[0]>=$maxtoday[0])
                            {
                              mysql_query("UPDATE ibwf_mpot SET ppl='".$result[0]."', dtm='".date("H:i:s")."' WHERE ddt='".date("d m y")."'");
                            }
                  }
                  as u can see theres bits // as i cant get to work .
                  Wapchat4u


                  Topsites4u

                  Comment


                    #10
                    Total online time and hourly reward of 50 plusses
                    PHP Code:
                    //////////////////////////////////////////////////////////////////// addonline 

                    function addonline($uid,$place,$plclink){ 
                    $tm time(); 
                    $timeout $tm 300//time out = 5 minutes 
                    mysql_query("DELETE FROM ibwf_online WHERE actvtime <'".$timeout."'"); 

                    $lttime mysql_fetch_array(mysql_query("SELECT lastact, plustime FROM ibwf_users WHERE id='".$uid."'")); 

                    $limit $tm $lttime[0]; 
                    if(
                    $limit<60){  //limit to 60 seconds away 
                    $newtime $lttime[1] + $limit
                    if(
                    $newtime>3600){ //1 hour 
                    mysql_query("UPDATE ibwf_users SET plustime='0', totaltime=toaltime+$newtime, plusses=plusses+50 WHERE id='".$uid."'"); 

                    $msg "Congratulation! You are Have Been Online For 1 Hour. You Have Recieved 50 plusses [br/][small]Note: This is an automated PM[/small]";  
                                            
                    autopm($msg$uid); 
                    }else{ 
                    mysql_query("UPDATE ibwf_users SET  totaltime=toaltime+$newtime, plustime='".$newtime."' WHERE id='".$uid."'"); 





                    mysql_query("UPDATE ibwf_users SET lastact='".$tm."' WHERE id='".$uid."'");  
                    $res mysql_query("INSERT INTO ibwf_online SET userid='".$uid."', actvtime='".$tm."', place='".$place."', placedet='".$plclink."'"); 

                    if(!
                    $res){ 
                    $res mysql_query("UPDATE ibwf_online SET actvtime='".$tm."', place='".$place."', placedet='".$plclink."', hide='".$hide."' WHERE userid='".$uid."'"); 


                    $maxmem mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id='2'")); 
                    $result mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online")); 
                    if(
                    $result[0]>=$maxmem[0]){ 

                    mysql_query("UPDATE ibwf_settings set name='".date("D d M Y - H:i")."', value='".$result[0]."' WHERE id='2'"); 


                    $maxtoday mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt='".date("d m y")."'")); 
                    if(
                    $maxtoday[0]==0||$maxtoday==""){ 
                    mysql_query("INSERT INTO ibwf_mpot SET ddt='".date("d m y")."', ppl='1', dtm='".date("H:i:s")."'"); 
                    $maxtoday[0]=1


                    if(
                    $result[0]>=$maxtoday[0]){ 
                    mysql_query("UPDATE ibwf_mpot SET ppl='".$result[0]."', dtm='".date("H:i:s")."' WHERE ddt='".date("d m y")."'"); 



                    PHP Code:
                    ALTER TABLE `ibwf_usersADD `totaltimeINT(100NOT NULL DEFAULT '0';
                    ALTER TABLE `ibwf_usersADD `plustimeINTNOT NULL DEFAULT '0'
                    Added after 2 minutes:

                    to call:
                    PHP Code:
                    $ttime mysql_fetch_array(mysql_query("SELECT totaltime FROM ibwf_users WHERE id='".$uid."'"));
                    echo 
                    "Total Online Time: $ttime[0]"
                    Last edited by something else; 05.09.10, 19:57.

                    Comment


                      #11
                      do i not have to put anything in register parts cos thats the main prob. when ppl register it says they been online for like random amount of years lol . could never get it so that it was zero when then registered . .
                      Wapchat4u


                      Topsites4u

                      Comment


                        #12
                        no point in setting time on register as the sql default is set to 0 so it starts counting up from that... i couldnt be bothered to work out seconds and days etc but think they were in the script at the top of this topic lol

                        Comment


                          #13
                          My mistake bro sorry and big thanks

                          Comment


                            #14
                            Plz tell me where that code to use?
                            LoveForum.BiZ

                            Comment


                              #15
                              ohhhhhh............looks like thats a cool work....thnx for ur code......


                              I'm Proud to be a Sri Lankan!

                              Comment

                              Working...
                              X