lang); // force deleting of timed out users if there is a silence in room or just entering if ((time() - $chat_lasttime) > $CFG->chat_old_ping) { // must be done before chat_get_latest_message!!! chat_delete_old_users(); } if ($message = chat_get_latest_message($chatuser->chatid, $chatuser->groupid)) { $chat_newlasttime = $message->timestamp; } else { $chat_newlasttime = 0; } if ($chat_lasttime == 0) { //display some previous messages $chat_lasttime = time() - $CFG->chat_old_ping; //TO DO - any better value?? } $refreshurl = "jsupdate.php?chat_sid=$chat_sid&chat_lasttime=$chat_newlasttime"; // no & in url, does not work in header! $timenow = time(); $groupselect = $chatuser->groupid ? " AND (groupid='".$chatuser->groupid."' OR groupid='0') " : ""; header('Expires: Sun, 28 Dec 1997 09:32:45 GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); header('Content-Type: text/html'); header("Refresh: $CFG->chat_refresh_room; url=$refreshurl"); ?> '; } ?> Refresh link