"; $db_link = SQL_connect(); $statement = "SELECT * FROM categories WHERE name='$category'"; $db_result = SQL_query($statement, $db_link); $posts = SQL_get_aff_rows($db_link, $db_result); $row = SQL_fetch_array($db_result, 0); $moderated = $row["moderated"]; $moderator = $row["moderator"]; $password = $row["password"]; if ($password) { check_auth($password); } print("
\n"); if (!$cur_limit) { $cur_limit = 0; } $user_mod = check_mod($moderator); if ($moderated && $user_mod) { // form the select statement $statement = "SELECT id FROM articles WHERE category='$category' AND thread_id=0 AND approved!=$moderated"; // output it... helpful for debugging purposes... //print("

SQL Statement: $statement

"); $db_result2 = SQL_query($statement, $db_link); // find out how many results there were... $mod_rows = SQL_get_aff_rows($db_link, $db_result2); if ($user_mod) { // form the select statement $statement = "SELECT * FROM articles WHERE category='$category' AND thread_id=0 ORDER BY touched DESC"; } } else { // form the select statement $statement = "SELECT * FROM articles WHERE category='$category' AND thread_id=0 AND approved=$moderated ORDER BY touched DESC"; } // output it... helpful for debugging purposes... //print("

SQL Statement: $statement

"); $count_res = SQL_query($statement, $db_link); $count_rows = SQL_get_aff_rows($db_link, $count_res); $db_result2 = SQL_query($statement . SQL_limit($cur_limit, $site_max_threads), $db_link); $aff_rows = SQL_get_aff_rows($db_link, $db_result2); $start_pos = $cur_limit + 1; $cur_pos = $cur_limit + $aff_rows; if ($aff_rows == 0) { print("

No posts found in this category yet.

\n"); include $inc_dir . "footer.php3"; exit; } //print("\n"); if ($count_rows > $aff_rows) { print("

Page "); $pages = ($count_rows / $site_max_threads); if ($count_rows % $site_max_threads) { $pages++; } $pages--; for ($page = 0; $page < $pages; $page++) { $page_disp = $page + 1; $start = $page * $site_max_threads; $page_url = $site_url . "browse" . $ext . "?category=" . urlencode($category) . "&cur_limit=$start"; if ($start == $cur_limit) { print(" $page_disp "); } else { print(" $page_disp "); } } print("

"); } $row_id = 0; if ($aff_rows > 0) { print("\n"); print("\n"); // get each row for ($db_rows = 0; $db_rows < $aff_rows; $db_rows++) { $row = SQL_fetch_array($db_result2, $db_rows); $replies = $row["replies"] + 1; $mydatetime = $row["posted"]; $pret_time = make_time($mydatetime); $mydatetime = $row["touched"]; $last_time = make_time($mydatetime); $status = $row["status"]; $realname = get_user_info_field($row["username"], $user_name_field); $thread_name = $row["title"]; $thread_name = make_clickable($thread_name); $thread_name = nl2br($thread_name); $thread_name = stripslashes($thread_name); $thread_id = $row["id"]; $clast_name = "$site_name-$category-last"; $clast_name = eregi_replace(" ", "_", $clast_name); $clast = $HTTP_COOKIE_VARS["$clast_name"]; if ($clast == "") { $clast = 0; } $cuser = $HTTP_COOKIE_VARS["$cookie_name-username"]; if ($cuser == "") { if ($REMOTE_USER != "") { $cuser = $REMOTE_USER; } } if ( $thread_name == "" ) $thread_name = "* n/a *"; $myunixtime = SQL_unixtime($db_link, $mydatetime); if ($cuser && $clast < $myunixtime) { $new_img = ""; } else { $new_img = "    "; } if (isset_bit($status, $FLAG_LOCKED_THREAD)) { $new_img .= "    " . $locked_img; } if (($db_rows % 2) == 1) { print("\n"); } else { print("\n"); } $thread_ref = $site_url . "browse_thread" . $ext . "?category=" . urlencode($category) . "&query=$thread_id&thread_name=" . urlencode($thread_name); print("\n"); print("\n"); } print("
 Thread NameNumber of PostsLatest PostThread Started
$new_img
$new_img$thread_name"); if ($moderated) { $st = "SELECT id FROM articles WHERE category='$category' AND (thread_id=$thread_id OR id=$thread_id) AND approved=$moderated"; $res = SQL_query($st, $db_link); $num = SQL_get_aff_rows($db_link, $res); if ($user_mod) { $st = "SELECT id FROM articles WHERE category='$category' AND (thread_id=$thread_id OR id=$thread_id) AND approved!=$moderated"; $res = SQL_query($st, $db_link); $num2 = SQL_get_aff_rows($db_link, $res); print("$num ($num2)"); } else { print("$num"); } } else { print("$replies"); } print("$last_time$pret_time
($realname)
\n"); } bottom_bar(); SQL_close($db_link); // thats all for the moment, folks... include $inc_dir . "footer.php3"; ?>