Hi,
I just wrote this code. Its autoupdated every minute with a cron job. The idea is to make all the members that are 'online' go 'offline' if they have been inactive for more then 5 min. Allthiugh, there is a bug in my code that just will not turn the 'user_online' back to 0 (0 = offline, 1 = online).
$tmp = 1;
$theTime = time();
$sql = "SELECT user_id, user_online, user_online_text FROM m_users WHERE user_online = '$tmp'";
$result = mysql_query($sql);
$tmp = 0;
while($row = mysql_fetch_array($result)){
$timestamp = strtotime($row['user_online_time']);
if($timestamp < $theTime){
$update = mysql_query("UPDATE m_users SET user_online='$tmp', user_online_time='$timestamp' WHERE user_id='$row['user_id']'");
}
}
Thanks!