<?php
include ("config.inc");
include ("forum.inc");
$dbh = db_connect();
$user = authenticate();
if ($user[Status] != 'Administrator') {
not_right ("You must be logged in, and be a valid administrator to access this.");
}
# ----------------------------------------------------------------------------
# If this is a moderator then they can only edit the boards that they moderate
$extra;
if ( $user[Status] == 'Moderator') {
$Username_q = db_quote($user[Username]);
$extra = "WHERE Moderator = $Username_q";
}
if ($extra) {
$extra = $extra."\nAND Security <= $user[Security]";
} else {
$extra = "WHERE Security <= $user[Security]";
}
# -----------------------------------------------
# Grab the current boards
$query = <<<END_SQL
SELECT Title,Number
FROM Boards
$extra
END_SQL;
$sth = mysql_query($query, $dbh) or die ("Query syntax error: $query. " . mysql_error() . "");
$rows = mysql_num_rows($sth);
# ------------------------
# Send them a page
send_header ("Edit a board.");
table_header("Edit a board.");
print "Choose a board from the list below that you would like to edit .";
print "<FORM METHOD=POST action=\"$config[cgiurl]/admin/viewboard.php\">";
print "<select name=\"Number\">";
for ($i=0;$i < $rows; $i++) {
list($Title,$Number) = mysql_fetch_array($sth);
print "<option value=$Number>$Title</option>";
}
print "</select>";
print "<br><br>";
print "<input type=submit value=\"Change this board\">";
# -------------------------------------------------------------------------
# If this is an admin then they get the option of deleting the board as well.
if ($user[Status] == 'Administrator') {
print "<input type=submit name=option value =\"Delete this board\">";
}
print "</form>";
mysql_free_result($sth);
send_footer();
?>