Originally posted by Ponick
View Post
Code:
///////////////////////////////////////Add to chat function addtochat($uid, $rid) { $bago = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE uid='".$uid."' AND rid='".$rid."'")); if($bago[0]==0){ $msg = "*mat Enter the Room"; mysql_query("INSERT INTO ibwf_chat SET timesent='".time()."', chatter='".$uid."', msgtext='".$msg."', rid='".$rid."'"); } $timeto = 120; $timenw = time(); $timeout = $timenw - $timeto; $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<'".$timeout."'"); $res = mysql_query("INSERT INTO ibwf_chonline SET lton='".time()."', uid='".$uid."', rid='".$rid."'"); if(!$res) { mysql_query("UPDATE ibwf_chonline SET lton='".time()."', rid='".$rid."' WHERE uid='".$uid."'"); }
and this in chat.php just after where if(!canenter($rid,$sid)) function end
Code:
addtochat($uid, $rid); $timeto = 300; $timenw = time(); $timeout = $timenw-$timeto; $deleted = mysql_query("DELETE FROM ibwf_chat WHERE timesent<".$timeout.""); $rooms = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_rooms WHERE id='".$rid."'")); $rname = $rooms[1]; $nick = getnick_sid($sid);
Comment