\n"); // connect to the server $db_link = SQL_connect(); $cookie_name = eregi_replace(" ", "_", $site_name); $cusername = $GLOBALS["$cookie_name-username"]; $cpassword = $GLOBALS["$cookie_name-password"]; if ($cusername == "") { $cusername = $PHP_AUTH_USER; } if ($cpassword == "") { $cpassword = $PHP_AUTH_PW; } if (!$cusername && !$cpassword) { print("\n"); print("tr align=center bgcolor=$trcolor>
Moderate
You must be logged in to access the moderation commands.
\n"); include $inc_dir . "footer.php3"; } $password = get_user_info_field($cusername, $passwd_field); if (!check_pw($cpassword, $password)) { print("Moderate\n"); print("Error: username and password do not match.\n"); SQL_close($db_link); include $inc_dir . "footer.php3"; exit; } if (eregi("del_t_confirm", $action)) { print("Moderate -- Delete Thread #$query\n"); print("TitleAuthorPosted At:\n"); $st = "SELECT * FROM articles WHERE category='$category' AND (id=$query OR thread_id=$query)"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); for ($db_rows = 0; $db_rows < $posts; $db_rows++) { $row = SQL_fetch_array($db_res, $db_rows); if (($db_rows % 2) == 1) { print("\n"); } else { print("\n"); } $title = $row["title"]; $author = $row["username"]; $posted = make_time($row["posted"]); print("$title$author$posted\n"); } print("
"); print("
"); } else if (eregi("del_p_confirm", $action)) { print("Moderate -- Delete Post #$query\n"); print("TitleAuthorPosted At:\n"); $st = "SELECT * FROM articles WHERE AND category='$category' AND id=$query AND thread_id!=0"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); if ($posts == 0) { print("No matching posts (perhaps this is the first of a thread?)."); } else { for ($db_rows = 0; $db_rows < $posts; $db_rows++) { $row = SQL_fetch_array($db_res, $db_rows); if (($db_rows % 2) == 1) { print("\n"); } else { print("\n"); } $title = $row["title"]; $thread_id = $row["thread_id"]; $author = $row["username"]; $posted = make_time($row["posted"]); print("$title$author$posted\n"); } print("
"); print(""); print("
"); } } else if (eregi("approve_confirm", $action)) { print("Moderate -- Approve Post #$query\n"); print("TitleAuthorPosted At:\n"); $st = "SELECT * FROM articles WHERE category='$category' AND id=$query AND approved!=1"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); if ($posts == 0) { print("No matching posts."); } else { for ($db_rows = 0; $db_rows < $posts; $db_rows++) { $row = SQL_fetch_array($db_res, $db_rows); if (($db_rows % 2) == 1) { print("\n"); } else { print("\n"); } $title = $row["title"]; $author = $row["username"]; $posted = make_time($row["posted"]); print("$title$author$posted\n"); } print("
"); print("
"); } } else if (eregi("unlock_confirm", $action)) { print("Moderate -- Unlock Thread #$query\n"); print("TitleAuthorPosted At:\n"); $st = "SELECT * FROM articles WHERE category='$category' AND (id=$query OR thread_id=$query) ORDER BY thread_id"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); for ($db_rows = 0; $db_rows < $posts; $db_rows++) { $row = SQL_fetch_array($db_res, $db_rows); if ($db_rows == 0) { $status = $row["status"]; } if (($db_rows % 2) == 1) { print("\n"); } else { print("\n"); } $title = $row["title"]; $author = $row["username"]; $posted = make_time($row["posted"]); print("$title$author$posted\n"); } print("
"); $newstatus = remove_bit($status, $FLAG_LOCKED_THREAD); print("\n\n"); print("
"); } else if (eregi("lock_confirm", $action)) { print("Moderate -- Lock Thread #$query\n"); print("TitleAuthorPosted At:\n"); $st = "SELECT * FROM articles WHERE category='$category' AND (id=$query OR thread_id=$query) ORDER BY thread_id"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); for ($db_rows = 0; $db_rows < $posts; $db_rows++) { $row = SQL_fetch_array($db_res, $db_rows); if ($db_rows == 0) { $status = $row["status"]; } if (($db_rows % 2) == 1) { print("\n"); } else { print("\n"); } $title = $row["title"]; $author = $row["username"]; $posted = make_time($row["posted"]); print("$title$author$posted\n"); } print("
"); $newstatus = set_bit($status, $FLAG_LOCKED_THREAD); print("\n\n"); print("
"); } else if (eregi("move_confirm", $action)) { print("Moderate -- Move Thread #$query\n"); print("TitleAuthorPosted At:\n"); $st = "SELECT * FROM articles WHERE category='$category' AND (id=$query OR thread_id=$query)"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); for ($db_rows = 0; $db_rows < $posts; $db_rows++) { $row = SQL_fetch_array($db_res, $db_rows); if (($db_rows % 2) == 1) { print("\n"); } else { print("\n"); } $title = $row["title"]; $author = $row["username"]; $posted = make_time($row["posted"]); print("$title$author$posted\n"); } print("
"); print("Move to category: "); print("
"); } else if (eregi("move_thread", $action)) { print("Moderate -- Move Thread #$query\n"); if ($new_cat != $category) { $st = "UPDATE articles SET category='$new_cat' WHERE category='$category' AND (id=$query OR thread_id=$query)"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); if ($posts > 0) { print("Thread $query moved.\n"); $url = "browse_thread" . $ext . "?category=" . urlencode($new_cat) . "&query=$query"; } else { $url = "browse" . $ext . "?category=" . urlencode($category); $error = SQL_get_error($db_link, $db_res); print("SQL: $st returned $posts rows affected.\n"); } } else { $url = "browse_thread" . $ext . "?category=" . urlencode($category) . "&query=$query"; print("Thread unmoved (destination is same as origin).\n"); } print("Go Back\n"); } else if (eregi("del_thread", $action)) { print("Moderate -- Delete Thread #$query\n"); $st = "DELETE FROM articles WHERE category='$category' AND (id=$query OR thread_id=$query)"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); if ($posts > 0) { print("Thread $query deleted.\n"); } else { $error = SQL_get_error($db_link, $db_res); print("SQL: $st returned $posts rows affected.\n"); } $url = "browse" . $ext . "?category=" . urlencode($category); print("Go Back\n"); } else if (eregi("unlock_thread", $action)) { print("Moderate -- Unlock Thread #$query\n"); $st = "UPDATE articles SET status=$newstatus WHERE category='$category' AND id=$query"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); if ($posts > 0) { print("Thread $query unlocked.\n"); } else { $error = SQL_get_error($db_link, $db_res); print("SQL: $st returned $posts rows affected.\n"); } $url = "browse_thread" . $ext . "?category=" . urlencode($category) . "&query=$query"; print("Go Back\n"); } else if (eregi("lock_thread", $action)) { print("Moderate -- Lock Thread #$query\n"); $st = "UPDATE articles SET status=$newstatus WHERE category='$category' AND id=$query"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); if ($posts > 0) { print("Thread $query locked.\n"); } else { $error = SQL_get_error($db_link, $db_res); print("SQL: $st returned $posts rows affected.\n"); } $url = "browse_thread" . $ext . "?category=" . urlencode($category) . "&query=$query"; print("Go Back\n"); } else if (eregi("del_post", $action)) { print("Moderate -- Delete Post #$query\n"); $st = "DELETE FROM articles WHERE category='$category' AND id=$query AND thread_id!=0"; $st2 = "UPDATE articles SET replies=replies-1 WHERE category='$category' AND id=$thread_id"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); if ($posts > 0) { $db_res2 = SQL_query($st2, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res2); if ($posts < 0) { $error = SQL_get_error($db_link, $db_res2); print("SQL: $st2 returned $posts rows affected. ($error)\n"); } print("Post $query deleted.\n"); } else { $error = SQL_get_error($db_link, $db_res); print("SQL: $st returned $posts rows affected ($error).\n"); } $url = "browse_thread" . $ext . "?category=" . urlencode($category) . "&query=$query"; print("Go Back\n"); } else if (eregi("approve_post", $action)) { print("Moderate -- Approve Post #$query\n"); $st = "UPDATE articles SET approved=1 WHERE category='$category' AND id=$query"; $db_res = SQL_query($st, $db_link); $posts = SQL_get_aff_rows($db_link, $db_res); if ($posts > 0) { print("Post $query approved.\n"); } else { print("SQL: $st returned $posts rows affected.\n"); } $url = "browse_thread" . $ext . "?category=" . urlencode($category) . "&query=$query"; print("Go Back\n"); } else { print("Moderate -- Error\n"); print("Error: unknown action '$action'.\n"); print("Go Back\n"); } print(""); include $inc_dir . "footer.php3"; ?>