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")."'");
}
}
Anyone know how to fix this, I've added the tables in the database
Comment