whats wrong with that? Pls. Help me?

Started on the old forum in January 2010 · view the original in the archive · old links redirect here

6 replies · 382 views · started 16 years ago · 1 min read

3 participants
arg0s12 Developer · 144 posts #1

whats wrong with this code? Every 9 pm in the evening, the system flooding, , this code is for 5 hours online stat, and in my profile, the output is 5 hrs stat: 14065 d, 20 h, 55 m, 30 s, something like that,

//////////////////////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;
$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)
    {
$text = "Congratulations you have reach the 5 hours online. You received 100 Plusses. [b]Note: This is an automatic pm[/b]";
mysql_query("INSERT INTO ibwf_private SET text='".$text."', byuid='332', 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")."'");
          }
}

pls tell me whats wrong,

kei_ki7 Senior · 431 posts #2

the time of your server = time()

Did I help you? You can help me too Your donations will help me finance my studies.

WereWolveZ Developer · 51 posts #3

just correct ur server time in ur site

With Christmas quickly approaching you’re going to need to get a gift for your werewolf lover and I’m here to help you out. Here are 10 gift ideas perfect for any fan of the furry.😌 http://vampires.com and http://darkness.com

arg0s12 Developer · 144 posts #4

kei_ki7 wrote: the time of your server = time()

mate do you mean, i put the time of my server in = time()? like what? I mean how?

arg0s12 Developer · 144 posts #5

WereWolveZ wrote: just correct ur server time in ur site

but bro, my time in my site is correct, but anyway i need to click the thanks button for both of you, thanks m8, i will try,

kei_ki7 Senior · 431 posts #6

you are using free host right? i dont know if time() can change, your time in main menu is correct, but not all. example in shout or inbox. they only referring to time() unlike your time in main menu, time() + $gmt

Did I help you? You can help me too Your donations will help me finance my studies.

arg0s12 Developer · 144 posts #7

yes! Im using freehostia,, , o.k i try first, thanks mate,

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close