online active time

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

    online active time

    yes yes i know this has been posted before and i have tried and failed with many variations of scripts that have it but i still cant get mine to work.

    wen i join up a test user i get online time like 42 years or sumat,.

    i have added all the bits in core and register parts in core.

    updated login . but ahhhhhhhhhhhhhh lol .

    heres wot i got
    core.php
    Code:
    function addonline($uid,$place,$plclink)
    {
      /////delete inactive users
      $tm = (time() - $timeadjust) ;
      $timeout = $tm - 420; //time out = 5 minutes
      $deloff = mysql_query("DELETE FROM dave_online WHERE actvtime <'".$timeout."'");
      
      ///now try to add user to online list and add total time online
      
      
      $lastactive = mysql_fetch_array(mysql_query("SELECT lastact FROM dave_users WHERE id='".$uid."'"));
      $tolsla = (time() - $timeadjust) - $lastactive[0];
      $totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM dave_users WHERE id='".$uid."'"));  
      $totaltimeonline = $totaltimeonline[0] + $tolsla;
      $res = mysql_query("UPDATE dave_users SET tottimeonl='".$totaltimeonline."' WHERE id='".$uid."'");
      
      
      $res = mysql_query("UPDATE dave_users SET lastact='".(time() - $timeadjust)."' WHERE id='".$uid."'");
      $res = mysql_query("INSERT INTO dave_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 dave_online SET actvtime='".$tm."', place='".$place."', placedet='".$plclink."' WHERE userid='".$uid."'");
        
        
      }
      $maxmem=mysql_fetch_array(mysql_query("SELECT value FROM dave_settings WHERE id='2'"));
      
                $result = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM dave_online"));
    
              if($result[0]>=$maxmem[0])
              {
                $tnow = date("D d M Y - H:i");
                mysql_query("UPDATE dave_settings set name='".$tnow."', value='".$result[0]."' WHERE id='2'");
              }
              $maxtoday = mysql_fetch_array(mysql_query("SELECT ppl FROM dave_mpot WHERE ddt='".date("d m y")."'"));
              if($maxtoday[0]==0||$maxtoday=="")
              {
                mysql_query("INSERT INTO dave_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 dave_mpot SET ppl='".$result[0]."', dtm='".date("H:i:s")."' WHERE ddt='".date("d m y")."'");
              }
    }
    register part of core
    Code:
        $reg = mysql_query("INSERT INTO dave_users SET name='".$name."', pass='".$pass."', birthday='".$year.$month.$day."', sex='".$usex."', location='".$uloc."', email='".$email."',news='".$news."', signature='".$info."', regdate='".time()."', validated='".$validated."', ipadd='".getip()."',lastvst='".(time() - $timeadjust)."', browserm='".browser()."'");
    login.php
    Code:
    $lact = mysql_fetch_array(mysql_query("SELECT lastact FROM dave_users WHERE id=".getuid_nick($uid).""));
                 mysql_query("UPDATE dave_users SET lastvst='".$lact[0]."' WHERE id=".getuid_nick($uid).""));
                 mysql_query("UPDATE dave_users SET lastact='".(time() - $timeadjust)."' WHERE id=".getuid_nick($uid).""));
    cheers in advance
    Wapchat4u


    Topsites4u

    #2
    Edit table dave_users and set defaut otime 0 ...

    else
    Post register() function here.
    whatmp3.name - search mp3 on mobile

    Comment


      #3
      think i see prob ur using lastseen for adding time that is wrong u just want to plus ( last action - time() ) + current onlinetime then add that to sql query to update should also put in so it wont add anything above 2 mins or ppl can cheat to get high online time

      Comment

      Working...
      X