\n"); print("
\n"); print("\n"); // connect to the server $db_link = SQL_connect(); // form the select statement $statement = "SELECT * FROM categories WHERE name='$cat_name'"; // output it... helpful for debugging purposes... //print("

SQL Statement: $statement

"); $db_result = SQL_query($statement, $db_link); // find out how many results there were... $aff_rows = SQL_get_aff_rows($db_link, $db_result); if ($aff_rows == 0) { print("
Edit Category Results
No such category found in this database...
\n"); SQL_close($db_link); include $inc_dir . "footer.php3"; exit; } else if ($aff_rows > 1) { print("More than one category found... data is not sane, aborting.\n"); SQL_close($db_link); include $inc_dir . "footer.php3"; exit; } $row = SQL_fetch_array($db_result, 0); $id = $row["id"]; $moderated = $row["moderated"]; $moderator = $row["moderator"]; $descript = $row["description"]; $pass = $row["password"]; $group = $row["catgroup"]; print("Name$cat_name\n"); if ($new_cat_mod) { print("ModeratedYes\n"); } else { print("ModeratedNo\n"); } if ($cat_mod_name) { print("Moderator Name$cat_mod_name\n"); } else { print("Moderator NameNo moderator\n"); } if (($cat_mod_name == "") && $new_cat_mod) { print("Moderated categories need a moderator.\n"); SQL_close($db_link); include $inc_dir . "footer.php3"; exit; } if (!$new_cat_mod && ($cat_mod_name != "")) { print("Unmoderated categories hardly need a moderator.\n"); SQL_close($db_link); include $inc_dir . "footer.php3"; exit; } if ($new_cat_mod != $moderated) { $st = "UPDATE categories SET moderated=\"$new_cat_mod\" WHERE name=\"$cat_name\" AND ID=$id"; // output it... helpful for debugging purposes... //print("SQL Statement: $st"); $db_result = SQL_query($st, $db_link); // find out how many results there were... $aff_rows = SQL_get_aff_rows($db_link, $db_result); if ($aff_rows == 1) { print("Moderation status updated...\n"); } // if the category was moderated (1) then approved status needs to flip to 0. // if the category was not moderated, then approved status needs to flip to 1. $st = "UPDATE articles SET approved=\"$new_cat_mod\" WHERE category=\"$cat_name\""; // output it... helpful for debugging purposes... //print("SQL Statement: $st"); $db_result = SQL_query($st, $db_link); // find out how many results there were... $aff_rows = SQL_get_aff_rows($db_link, $db_result); if ($aff_rows > 0) { print("Articles updated...\n"); } } if ($cat_group != $group) { $st = "UPDATE categories SET catgroup=\"$cat_group\" WHERE name=\"$cat_name\" AND ID=$id"; // output it... helpful for debugging purposes... //print("SQL Statement: $st"); $db_result = SQL_query($st, $db_link); // find out how many results there were... $aff_rows = SQL_get_aff_rows($db_link, $db_result); if ($aff_rows == 1) { print("Group updated...\n"); } } if ($moderator != $cat_mod_name) { $st = "UPDATE categories SET moderator=\"$cat_mod_name\" WHERE name=\"$cat_name\" AND ID=$id"; // output it... helpful for debugging purposes... //print("SQL Statement: $st"); $db_result = SQL_query($st, $db_link); // find out how many results there were... $aff_rows = SQL_get_aff_rows($db_link, $db_result); if ($aff_rows == 1) { if ($cat_mod_name =="") { print("Moderator removed...\n"); } else if ($moderator == "") { print("Moderator set.\n"); } else { print("Moderator $moderator replaced.\n"); } } } print("Category Description$cat_desc\n"); if ($descript != $cat_desc) { $st = "UPDATE categories SET description=\"$cat_desc\" WHERE name=\"$cat_name\" AND ID=$id"; // output it... helpful for debugging purposes... //print("SQL Statement: $st"); $db_result = SQL_query($st, $db_link); // find out how many results there were... $aff_rows = SQL_get_aff_rows($db_link, $db_result); if ($aff_rows == 1) { print("Description updated...\n"); } } if ($pass != $cat_pass) { $st = "UPDATE categories SET password=\"$cat_pass\" WHERE name=\"$cat_name\" AND ID=$id"; // output it... helpful for debugging purposes... //print("SQL Statement: $st"); $db_result = SQL_query($st, $db_link); // find out how many results there were... $aff_rows = SQL_get_aff_rows($db_link, $db_result); if ($aff_rows == 1) { print("Password updated...\n"); } } print("
\n"); include $inc_dir . "footer.php3"; ?>