kann mir einer helfen ich versuche im internen Forum die ersten Post also die Startpost anders zu gestalten und weiß nicht wie ich richtig anfangen soll
laut meiner forums.php müsste das
PHP-Code:
//---- Get poster details
$res2 = mysql_query("SELECT * FROM users WHERE id=$posterid") or sqlerr(__FILE__, __LINE__); $arr2 = mysql_fetch_assoc($res2); $sig = $arr2[sig];
if ($pn == $pc) { print("<a name=last>"); if ($postid > $lpr) mysql_query("UPDATE readposts SET lastpostread=$postid WHERE userid=$userid AND topicid=$topicid") or sqlerr(__FILE__, __LINE__); }
if ($arr2["avatar"]) { $avatar = ("<img style=\"width:120px;\" src=\"".htmlspecialchars($arr2["avatar"])."\">");
if ($bedanko == "2") { $body1 .= "<br>$thanksbutton<br>"; }
if ($thanks && $ptpostid == $postid) { $body1 .= "<br>Für diesen Beitrag haben sich bedankt:"; $body1 .= "<br>$thanks"; }
if (is_valid_id($arr['editedby'])) { $res4 = mysql_query("SELECT id, username, class FROM users WHERE id=$arr[editedby]"); if (mysql_num_rows($res4) == 1) { $arr4 = mysql_fetch_assoc($res4); $body1 .= "<br><br><font class=\"smallfont\">Zuletzt bearbeitet von <a href=\"userdetails.php?id=$arr[editedby]\"><b><font class=\"".get_class_color($arr4["class"])."\">$arr4[username]</font></b></a> am $arr[editedat]</font>."; } }
if ($sig) { $body1 .= "<br>____________________<br>".format_comment($sig).""; }
//-------- Returns the forum ID of a topic, or false on error
function get_topic_forum($topicid) { $res = mysql_query("SELECT forumid FROM topics WHERE id=$topicid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) != 1) return false;
$arr = mysql_fetch_row($res); return $arr[0]; }
//-------- Returns the ID of the last post of a forum
function update_topic_last_post($topicid) { $res = mysql_query("SELECT id FROM posts WHERE topicid=$topicid ORDER BY id DESC LIMIT 1") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_row($res) or die("Es sind keine Beiträge vorhanden."); $postid = $arr[0];
mysql_query("UPDATE topics SET lastpost=$postid WHERE id=$topicid") or sqlerr(__FILE__, __LINE__); }
function get_forum_last_post($forumid) { $res = mysql_query("SELECT lastpost FROM topics WHERE forumid=$forumid ORDER BY lastpost DESC LIMIT 1") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_row($res); $postid = $arr[0];
if ($postid) return $postid;
else return 0; }
//-------- Inserts a quick jump menu
function insert_quick_jump_menu($currentforum = 0) { print("<form method=get action=? name=jump>");
function insert_compose_frame($id, $newtopic = true, $quote = false) { global $maxsubjectlength, $CURUSER;
if ($newtopic) { $res = mysql_query("SELECT name, allowpoll FROM forums WHERE id=$id") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_assoc($res) or stderr("Forum Fehler", "<b><p>Falsche Foren ID.</p></b>"); $forumname = $arr["name"]; $allowpoll = $arr["allowpoll"];
} else { $res = mysql_query("SELECT * FROM topics WHERE id=$id") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_assoc($res) or stderr("Forum Fehler", "<b><p>Das Thema konnte nicht gefunden werden.</p></b>"); $subject = $arr["subject"];
if ($quote) { $postid = $_GET["postid"]; if (!is_valid_id($postid)) die;
$res = mysql_query("SELECT posts.*, users.username, users.sig FROM posts JOIN users ON posts.userid = users.id WHERE posts.id=$postid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) != 1) stderr(" Forum Fehler", "<b><p>Es ist kein Thema mit der ID $postid vorhanden.</p></b>");
if (!$subject) stderr("Forum Fehler", "<b><p>Du musst eine Überschrift eingeben.</p></b>");
if (strlen($subject) > $maxsubjectlength) stderr("Forum Fehler", "<b><p>Die Überschrift hat die maxlänge von $maxsubjectlength Buchstaben erreicht.</p></b>"); }
else $forumid = get_topic_forum($topicid) or stderr("Forum Fehler", "<b><p>Die Themen ID ist falsch.</p></b>");
//------ Make sure sure user has write access in forum
$arr = get_forum_access_levels($forumid) or stderr("Forum Fehler", "<b><p>Die Themen ID ist falsch.</p></b>");
if (get_user_class() < $arr["write"] || ($newtopic && get_user_class() < $arr["create"])) stderr("Forum Fehler", "<b><p>Dir fehlen die Rechte um hier etwas schreiben zu können.</p></b>");
$body = trim($_POST["body"]);
if ($body == "") stderr("Forum Fehler", "<b><p>Der Inhalt darf nicht leer sein.</p></b>");
$userid = $CURUSER["id"];
if ($newtopic) {
//---- Create topic
$subject = sqlesc($subject);
mysql_query("INSERT INTO topics (userid, forumid, subject) VALUES($userid, $forumid, $subject)") or sqlerr(__FILE__, __LINE__);
$topicid = mysql_insert_id() or stderr("Forum Fehler", "<b><p>Die Themen ID konnte nicht gefunden werden.</p></b>");
$polltopic = mysql_query("SELECT id FROM topics ORDER BY id DESC LIMIT 1"); $polltopicfetch = mysql_fetch_assoc($polltopic); $polltopic2 = $polltopicfetch["id"];
mysql_query("INSERT INTO posts (topicid, userid, added, body) VALUES($topicid, $userid, $added, $body)") or sqlerr(__FILE__, __LINE__);
$postid = mysql_insert_id() or stderr("Forum Fehler", "<b><p>Kommentar ID nicht gefunden!</p></b>");
$setbedanko = ($_POST["bedanko"] == "2" ? "yes" : "no"); if ($setbedanko == 'yes'){ $bedanko = 2; } else { $bedanko = 1; } mysql_query("UPDATE posts SET bedanko = '$bedanko' WHERE id = '$postid'") or sqlerr(__FILE__, __LINE__);
mysql_query("UPDATE forums SET postcount = postcount + 1 WHERE id=$forumid") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE forums SET topiccount = topiccount + 1 WHERE id=$forumid") or sqlerr(__FILE__, __LINE__); } else {
//---- Make sure topic exists and is unlocked
$res = mysql_query("SELECT * FROM topics WHERE id=$topicid") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_assoc($res) or stderr("Forum Fehler", "<b><p>Die Themen ID konnte nicht gefunden werden.</p></b>");
if ($arr["locked"] == 'yes' && get_user_class() < UC_SYSOP) stderr("Forum Fehler", "<b><p>Dieses Thema ist geschlossen.</p></b>");
$res = mysql_query("SELECT * FROM topics WHERE id=$topicid") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_assoc($res) or stderr("Forum Fehler", "<b><p>Das Thema konnte nicht gefunden werden.</p></b>");
if ($page[0] == "p") { $findpost = substr($page, 1); $res = mysql_query("SELECT id FROM posts WHERE topicid=$topicid ORDER BY added") or sqlerr(__FILE__, __LINE__); $i = 1;
while ($arr = mysql_fetch_row($res)) { if ($arr[0] == $findpost) break; ++$i; } $page = ceil($i / $perpage); }
if ($page == "last") $page = $pages;
else { if($page < 1) $page = 1;
elseif ($page > $pages) $page = $pages; }
$offset = $page * $perpage - $perpage;
for ($i = 1; $i <= $pages; ++$i) { if ($i == $page) $pagemenu .= "<center><font class=gray><b>$i</b></font><center>";
$respoll = mysql_query("SELECT * FROM forum_polls WHERE topicid=$topicid") or sqlerr(); $arrpoll = mysql_fetch_assoc($respoll); if (is_array($arrpoll)) { $pollid = $arrpoll["id"]; $question = $arrpoll["question"]; $o = array($arrpoll["option0"], $arrpoll["option1"], $arrpoll["option2"], $arrpoll["option3"], $arrpoll["option4"], $arrpoll["option5"], $arrpoll["option6"], $arrpoll["option7"], $arrpoll["option8"], $arrpoll["option9"], $arrpoll["option10"]);
// check if user has already voted $respoll = mysql_query("SELECT * FROM forum_pollanswers WHERE pollid=$pollid AND userid=$userid") or sqlerr(); $arr2poll = mysql_fetch_assoc($respoll);
$resa = mysql_query("SELECT * FROM postthanks WHERE topicid = $topicid") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($resa) > 0) { while ($arra = mysql_fetch_array($resa)) { $ptuserid = $arra["userid"]; $ptpostid = $arra["postid"];
$resb = mysql_query("SELECT id, username, class FROM users WHERE id = $ptuserid") or print(mysql_error()); while ($arrb = mysql_fetch_assoc($resb)) { if ($thanks) $thanks .= ",\n";
if ($pn == $pc) { print("<a name=last>"); if ($postid > $lpr) mysql_query("UPDATE readposts SET lastpostread=$postid WHERE userid=$userid AND topicid=$topicid") or sqlerr(__FILE__, __LINE__); }
if ($arr2["avatar"]) { $avatar = ("<img style=\"width:120px;\" src=\"".htmlspecialchars($arr2["avatar"])."\">");
if ($bedanko == "2") { $body1 .= "<br>$thanksbutton<br>"; }
if ($thanks && $ptpostid == $postid) { $body1 .= "<br>Für diesen Beitrag haben sich bedankt:"; $body1 .= "<br>$thanks"; }
if (is_valid_id($arr['editedby'])) { $res4 = mysql_query("SELECT id, username, class FROM users WHERE id=$arr[editedby]"); if (mysql_num_rows($res4) == 1) { $arr4 = mysql_fetch_assoc($res4); $body1 .= "<br><br><font class=\"smallfont\">Zuletzt bearbeitet von <a href=\"userdetails.php?id=$arr[editedby]\"><b><font class=\"".get_class_color($arr4["class"])."\">$arr4[username]</font></b></a> am $arr[editedat]</font>."; } }
if ($sig) { $body1 .= "<br>____________________<br>".format_comment($sig).""; }
if (!is_valid_id($forumid1) || !is_valid_id($topicid) || get_user_class() < UC_SYSOP) die;
// Make sure topic and forum is valid
$res = @mysql_query("SELECT minclasswrite FROM forums WHERE id=$forumid1") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) != 1) stderr("Forum Fehler", "<b><p>Das Forum konnte nicht gefunden werden.</p></b>");
$arr = mysql_fetch_row($res);
if (get_user_class() < $arr[0]) die;
$res = @mysql_query("SELECT subject,forumid FROM topics WHERE id=$topicid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) != 1) stderr("Forum Fehler", "<b><p>Das Thema konnte nicht gefunden werden.</p></b>");
$arr = mysql_fetch_assoc($res);
if ($arr["forumid"] != $forumid1) @mysql_query("UPDATE topics SET forumid=$forumid1 WHERE id=$topicid") or sqlerr(__FILE__, __LINE__);
$res = mysql_query("SELECT COUNT(*) FROM posts WHERE topicid=$topicid") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_row($res);
$postcount = $arr[0];
mysql_query("UPDATE forums SET postcount = postcount + $postcount WHERE id=$forumid1") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE forums SET topiccount = topiccount + 1 WHERE id=$forumid1") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE forums SET postcount = postcount - $postcount WHERE id=$forumid2") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE forums SET topiccount = topiccount - 1 WHERE id=$forumid2") or sqlerr(__FILE__, __LINE__);
if (!is_valid_id($topicid) || get_user_class() < UC_SYSOP) die;
$sure = $_GET["sure"];
if ($sure == "") { stderr("Thema löschen", "<b><p>Du hast kein Thema zum löschen ausgewählt!</p></b>"); }
if ($sure == "2") { stderr("Thema löschen", "<b><p>Du bist im Begriff dieses Thema zu löschen? Klicke <a href=?action=deletetopic&topicid=$topicid&forumid=$forumid&sure=1>HIER</a> wenn du dir sicher bist!</p></b>"); }
$res = mysql_query("SELECT COUNT(*) FROM posts WHERE topicid=$topicid") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_row($res);
$postcount = $arr[0];
mysql_query("DELETE FROM topics WHERE id=$topicid") or sqlerr(__FILE__, __LINE__); mysql_query("DELETE FROM posts WHERE topicid=$topicid") or sqlerr(__FILE__, __LINE__); mysql_query("DELETE FROM readposts WHERE topicid=$topicid") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE forums SET postcount = postcount - $postcount WHERE id=$forumid") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE forums SET topiccount = topiccount - 1 WHERE id=$forumid") or sqlerr(__FILE__, __LINE__);
$res = mysql_query("SELECT id FROM forum_polls WHERE topicid=$topicid"); $arr = mysql_fetch_assoc($res); $topicidpoll = $arr["id"]; mysql_query("DELETE FROM forum_pollanswers WHERE pollid=$topicidpoll"); mysql_query("DELETE FROM forum_polls WHERE topicid=$topicid");
if ($action == "editpost") { $postid = $_GET["postid"];
if (!is_valid_id($postid)) die;
$res = mysql_query("SELECT * FROM posts WHERE id=$postid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) != 1) stderr("Forum Fehler", "<b><p>Es ist kein Beitrag mit der ID $postid vorhanden.</p></b>");
$arr = mysql_fetch_assoc($res); $res2 = mysql_query("SELECT locked, subject FROM topics WHERE id = " . $arr["topicid"]) or sqlerr(__FILE__, __LINE__); $arr2 = mysql_fetch_assoc($res2);
if (mysql_num_rows($res) != 1) stderr("Forum Fehler", "<b><p>Es ist kein Thema mit der ID $postid vorhanden.</p></b>");
$locked = ($arr2["locked"] == 'yes');
if (($CURUSER["id"] != $arr["userid"] || $locked) && get_user_class() < UC_SYSOP) stderr("Forum Fehler", "<b><p>Du hast keine Berechtigung um diesen Beitrag zu ändern!</p></b>");
if ($_SERVER["REQUEST_METHOD"] == "POST") { $subject = $_POST['subject'];
if ($subject == "") stderr("Forum Fehler", "<b><p>Das Thema darf nicht leer sein!</p></b>");
$subject = sqlesc($subject);
mysql_query("UPDATE topics SET subject=$subject WHERE id = " . $arr["topicid"]) or sqlerr(__FILE__, __LINE__);
$body = $_POST['body'];
if ($body == "") stderr("Forum Fehler", "<b><p>Der Inhalt darf nicht leer sein!</p></b>");
if ($action == "edit") { $postid = $_GET["postid"];
if (!is_valid_id($postid)) die;
$res = mysql_query("SELECT * FROM posts WHERE id=$postid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) != 1) stderr("Forum Fehler", "<b><p>Es ist kein Beitrag mit der ID $postid vorhanden.</p></b>");
$arr = mysql_fetch_assoc($res); $res2 = mysql_query("SELECT locked, userid, subject FROM topics WHERE id = " . $arr["topicid"]) or sqlerr(__FILE__, __LINE__); $arr2 = mysql_fetch_assoc($res2);
if (mysql_num_rows($res) != 1) stderr("Forum Fehler", "<b><p>Es ist kein Thema mit der ID $postid vorhanden.</p></b>");
$locked = ($arr2["locked"] == 'yes');
if (($CURUSER["id"] != $arr["userid"] || $locked) && get_user_class() < UC_SYSOP) stderr("Forum Fehler", "<b><p>Du hast keine Berechtigung um diesen Beitrag zu ändern!</p></b>");
$resc = mysql_query("SELECT id FROM posts WHERE topicid=$arr[topicid] ORDER BY id ASC LIMIT 1") or sqlerr(__FILE__, __LINE__); $arrc = mysql_fetch_assoc($resc);
if (get_user_class() < UC_SYSOP || !is_valid_id($postid)) die;
//------- Get topic id
$res = mysql_query("SELECT topicid FROM posts WHERE id=$postid") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_row($res) or stderr("Forum Fehler", "<b><p>Der Beitrag wurde nicht gefunden!</p></b>");
$topicid = $arr[0];
//------- We can not delete the post if it is the only one of the topic
$res = mysql_query("SELECT COUNT(*) FROM posts WHERE topicid=$topicid") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_row($res);
if ($arr[0] < 2) stderr("Forum Fehler", "<b><p>Der Beitrag kann nicht gelöscht werden, es ist der erste Beitrag dieses Themas. Klicke <a href=?action=deletetopic&topicid=$topicid&forumid=$forumid&sure=1>HIER</a> um das Thema zu löschen.</p></b>");
//------- Get the id of the last post before the one we're deleting
$res = mysql_query("SELECT id FROM posts WHERE topicid=$topicid AND id < $postid ORDER BY id DESC LIMIT 1") or sqlerr(__FILE__, __LINE__);
if (!$sure) { stderr("Beitrag löschen", "<b><p>Bist du dir sicher das du diesen Beitrag löschen willst? Klicke <a href=?action=deletepost&postid=$postid&forumid=$forumid&sure=1>HIER</a> wenn du dir sicher bist.</p></b>"); }
//------- Delete post
$forumid = $_GET["forumid"]; mysql_query("DELETE FROM posts WHERE id=$postid") or sqlerr(__FILE__, __LINE__); mysql_query("DELETE FROM readposts WHERE topicid=$topicid") or sqlerr(__FILE__, __LINE__); mysql_query("UPDATE forums SET postcount = postcount - 1 WHERE id=$forumid") or sqlerr(__FILE__, __LINE__);
if (!is_valid_id($topicid) || get_user_class() < UC_SYSOP) die;
mysql_query("UPDATE topics SET locked='yes' WHERE id=$topicid") or sqlerr(__FILE__, __LINE__); header("Location: $BASEURL/forums.php?action=viewforum&forumid=$forumid&page=$page"); die; }
if (!is_valid_id($topicid) || get_user_class() < UC_SYSOP) die;
mysql_query("UPDATE topics SET locked='no' WHERE id=$topicid") or sqlerr(__FILE__, __LINE__); header("Location: $BASEURL/forums.php?action=viewforum&forumid=$forumid&page=$page"); die; }
//-------- Action: Set locked on/off
if ($action == "setlocked") { $topicid = 0 + $_POST["topicid"];
if (!$topicid || get_user_class() < UC_SYSOP) die;
$locked = sqlesc($_POST["locked"]); mysql_query("UPDATE topics SET locked=$locked WHERE id=$topicid") or sqlerr(__FILE__, __LINE__); header("Location: $_POST[returnto]"); die; }
//-------- Action: Set sticky on/off
if ($action == "setsticky") { $topicid = 0 + $_POST["topicid"];
if (!topicid || get_user_class() < UC_SYSOP) die;
$sticky = sqlesc($_POST["sticky"]); mysql_query("UPDATE topics SET sticky=$sticky WHERE id=$topicid") or sqlerr(__FILE__, __LINE__); header("Location: $_POST[returnto]"); die; }
//-------- Action: Rename topic
if ($action == 'renametopic') {
if (get_user_class() < UC_SYSOP) die;
$topicid = $_POST['topicid'];
if (!is_valid_id($topicid)) die;
$subject = $_POST['subject'];
if ($subject == '') stderr("Forum Fehler", "<b><p>Du musst einen neuen Titel eintragen!</p></b>");
$subject = sqlesc($subject); mysql_query("UPDATE topics SET subject=$subject WHERE id=$topicid") or sqlerr(); $returnto = $_POST['returnto'];
if ($returnto) header("Location: $returnto"); die; }
//-------- Action: View forum
if ($action == "viewforum") { $forumid = $_GET["forumid"];
if (!is_valid_id($forumid)) die;
$page = $_GET["page"]; $userid = $CURUSER["id"];
//------ Get forum name
$res = mysql_query("SELECT name, minclassread FROM forums WHERE id=$forumid") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_assoc($res) or die; $forumname = $arr["name"];
if (get_user_class() < $arr["minclassread"]) die("Kein Zugriff");
//------ Page links
//------ Get topic count
$perpage = $CURUSER["topicsperpage"];
if (!$perpage) $perpage = 20; $res = mysql_query("SELECT COUNT(*) FROM topics WHERE forumid=$forumid") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_row($res); $num = $arr[0];
$topicsres = mysql_query("SELECT * FROM topics WHERE forumid=$forumid ORDER BY sticky, lastpost DESC LIMIT $offset,$perpage") or stderr("SQL Fehler", mysql_error());
//------ Get author $res2 = mysql_query("SELECT username, class FROM users WHERE id=$topic_userid") or sqlerr(__FILE__, __LINE__); $arr2 = mysql_fetch_assoc($res2);
$post_res = mysql_query("SELECT * FROM posts WHERE id=$lastpostid") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($post_res) == 1) { $post_arr = mysql_fetch_assoc($post_res) or die("Falsche Foren-ID last_post"); $lastposterid = $post_arr["userid"]; $lastpostdate = $post_arr["added"];
if($post_arr["guestuser"] == "no") { $user_res = mysql_query("SELECT username, class FROM users WHERE id=$lastposterid") or sqlerr(__FILE__, __LINE__); $user_arr = mysql_fetch_assoc($user_res);
$r = mysql_query("SELECT lastpostread FROM readposts WHERE userid=$userid AND topicid=$topicid") or sqlerr(__FILE__, __LINE__); $a = mysql_fetch_row($r);
if ($a && $a[0] == $arr['lastpost']) continue;
//---- Check access & get forum name
$r = mysql_query("SELECT name, minclassread FROM forums WHERE id=$forumid") or sqlerr(__FILE__, __LINE__); $a = mysql_fetch_assoc($r);
if ($n == 0) { print("<tr><td colspan=\"3\" class=\"tablea\"><b><p>Es wurden keine ungelesenen Themen gefunden.</p></b></td></tr>"); } print("</table><br>");
print("<br> <img src=\"".$GLOBALS["PIC_BASE_URL"]."unlockednew.gif\"> <b>Neue Antworten</b> <img src=\"".$GLOBALS["PIC_BASE_URL"]."unlocked.gif\"> <b>Gelesene Antworten</b> <img src=\"".$GLOBALS["PIC_BASE_URL"]."lockednew.gif\"> <b>Neue Geschlossene Themen</b> <img src=\"".$GLOBALS["PIC_BASE_URL"]."locked.gif\"> <b>Gelesene Geschlossene Themen</b><br> "); if ($n > $maxresults) { print("<b><p>Es wurden mehr als $maxresults ungelesene Threads gefunden, die ersten $maxresults werden angezeigt.</p></b>"); }
print("</table><br>");
end_frame(); stdfoot(); die; }
//---- Search
if ($action == "search") { stdhead("Forum"); begin_frame("<span class=normalfont><b>Forum</b></span>");
$res = mysql_query("SELECT COUNT(*) FROM posts WHERE MATCH (body) AGAINST ($ekeywords)") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_row($res); $hits = 0 + $arr[0];
$res = mysql_query("SELECT * FROM posts WHERE MATCH (body) AGAINST ($ekeywords) LIMIT $offset,$perpage") or sqlerr(__FILE__, __LINE__); $num = mysql_num_rows($res);
for ($i = 0; $i < $num; ++$i) { $post = mysql_fetch_assoc($res); $res2 = mysql_query("SELECT forumid, subject FROM topics WHERE id=$post[topicid]") or sqlerr(__FILE__, __LINE__); $topic = mysql_fetch_assoc($res2);
$res3 = mysql_query("SELECT name, minclassread FROM forums WHERE id=$topic[forumid]") or sqlerr(__FILE__, __LINE__); $forum = mysql_fetch_assoc($res3);
$res4 = mysql_query("SELECT username, class FROM users WHERE id=$post[userid]") or sqlerr(__FILE__, __LINE__); $user = mysql_fetch_assoc($res4); $username = ("<font class=\"".get_class_color($user["class"])."\"><b>$user[username]</b></font>");
$forums_cat = mysql_query("SELECT * FROM forum_cats ORDER BY sort, name") or sqlerr(__FILE__, __LINE__); while ($forums_catarr = mysql_fetch_assoc($forums_cat)) { if (get_user_class() < $forums_catarr["minclassread"]) continue;
$r = mysql_query("SELECT lastpostread FROM readposts WHERE userid=$CURUSER[id] AND topicid=$lasttopicid") or sqlerr(__FILE__, __LINE__); $a = mysql_fetch_row($r);
if ($a && $a[0] >= $lastpostid) $img = "unlocked";