$maxaantal) { $verschil = $aantal - $maxaantal; $query = "SELECT id FROM chat_text_db ORDER BY date ASC LIMIT 0, $verschil;"; $res1 = mysql_query($query, $mysql_link); while ($r = mysql_fetch_array($res1)) { $ids .= $r["id"].","; } $ids = substr($ids, 0, strrpos($ids, ",")); mysql_query("DELETE FROM chat_text_db WHERE id IN ($ids);", $mysql_link); } $eerste = "nee"; $is_tekst = TRUE; $username = user($mysql_link, $session); $username = addslashes($username); if ($session != "") { check_secure($mysql_link, $session); if ($state=="") { $state="started"; $eerste="ja"; $readback = 10; if ($lijst == "no") { $readback = 0; } $query = "SELECT MAX(id)-$readback AS latestid FROM chat_text_db;"; $ids = mysql_query($query, $mysql_link); $temp = mysql_fetch_array($ids); $latestid = $temp["latestid"]; if ($latestid != "") $is_tekst = TRUE; if ($latestid == "") $is_tekst = FALSE; } $check_userlist = $userlist; if ($is_tekst): // start if // show chat messages $query = "SELECT * FROM chat_text_db WHERE id > $latestid AND status = '50';"; $cm_result = mysql_query($query, $mysql_link); $query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto = '0' ORDER BY date ASC;"; $result = mysql_query($query, $mysql_link); // can this user see all private entries ? $userlevel = user_level($mysql_link, $session); if (!validate($userlevel, _readprivate)) { $query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto = '$username' AND saidby != '$username' ORDER BY date ASC;"; $result2 = mysql_query($query, $mysql_link); $is_god = FALSE; } else { $query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto != '0' AND saidto != '1' AND status != '50' ORDER BY date ASC;"; $result2 = mysql_query($query, $mysql_link); $is_god = TRUE; } $query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto <> '0' AND saidby = '$username' AND saidto != '1' AND status != '50' ORDER BY date ASC;"; $result3 = mysql_query($query, $mysql_link); $mods = FALSE; if (validate($userlevel, _modmessages)) { // get modmessages $query = "SELECT * FROM chat_text_db WHERE id > $latestid AND saidto = '1' ORDER BY date ASC;"; $result4 = mysql_query($query, $mysql_link); $mods=TRUE; } $query = "SELECT MAX(id) AS latestid FROM chat_text_db;"; $ids = mysql_fetch_array(mysql_query($query, $mysql_link)); $latestid = $ids["latestid"]; $data = ""; $data2 = ""; $data3 = ""; while ($rec = mysql_fetch_array($cm_result)) { $pr_cm = TRUE; if ($rec["saidto"] == "ask_for_refresh") { ?> 99"; if (validate($userlevel, _canseeinvisible)) $add_tag=""; $query = "SELECT login FROM chat_session_ids $add_tag ORDER BY id;"; $idresult = mysql_query($query, $mysql_link); while ($recc = mysql_fetch_array($idresult)) { $userlist .= $recc["login"].","; } ?>