<?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.");
}
$FORM = get_input();
# ------------------------
# Send them a page
send_header ("Unban a User / Host");
table_header("Unban a User / Host.");
print "Select which Username or Hostname you want to unban.";
print "<FORM METHOD=POST action=\"$config[cgiurl]/admin/dounbanuser.php\">";
# ---------------------
# Give the banned users
$query = <<<END_SQL
SELECT Username
FROM Banned
WHERE Username <> "NULL"
ORDER BY Username
END_SQL;
$sth = mysql_query($query) or die ("Query syntax error: $query. Reason: " . mysql_error() . "");
$rows = mysql_num_rows($sth);
if ($rows < 1) {
print "There are no banned Usernames.";
mysql_free_result($sth);
} else {
print "<select name = \"Username\">";
for ($i=0;$i<$rows;$i++){
list($Username) = mysql_fetch_array($sth);
mysql_free_result($sth);
print "<option>$Username</option>";
}
print "</select>";
print "<input type=submit name=option value=\"Unban this Username\">";
}
print "<br><br>";
# -------------------------
# Give the banned hostnames
$query = <<<END_SQL
SELECT Hostname
FROM Banned
WHERE Hostname <> "NULL"
ORDER BY Hostname
END_SQL;
$sth = mysql_query($query) or die ("Query syntax error: $query. Reason: " . mysql_error() . "");
$rows = mysql_num_rows($sth);
if ($rows < 1) {
print "There are no banned Hostnames.";
mysql_free_result($sth);
} else {
print "<select name = \"Hostname\">";
for ($i=0;$i<$rows;$i++){
list($Hostname) = mysql_fetch_array($sth);
mysql_free_result($sth);
print "<option>$Hostname</option>";
}
print "</select>";
print "<input type=submit name=option value=\"Unban this Hostname\">";
}
print "</form>";
send_footer();
?>