%s AND `online` = 1",$channel,strtotime('-1 minute')); //Get all users in the last minute(update.php timeout is 30 seconds). while($row = mysql_fetch_array($result)) $userlist[] = $row['username']; return $userlist; } function notifyJoin($nick,$channel) { sql_query("INSERT INTO `irc_lines` (name1,type,channel,time,online) VALUES('%s','join','%s','%s',1)",$nick,$channel,time()); } function notifyPart($nick,$channel) { sql_query("INSERT INTO `irc_lines` (name1,type,channel,time,online) VALUES('%s','part','%s','%s',1)",$nick,$channel,time()); } function CleanOfflineUsers() { $result = sql_query("SELECT * FROM `irc_users` WHERE `time` < %s",strtotime('-1 minute')); sql_query("DELETE FROM `irc_users` WHERE `time` < %s",strtotime('-1 minute')); while ($row = mysql_fetch_array($result)) notifyPart($row['username'],$row['channel']); } ?>