require "include/bittorrent.php"; dbconn(false); loggedinorreturn(); if( get_user_class() < UC_MODERATOR) stderr( _("Error"), _("Permission denied.")); $remove = (int) $_GET['remove']; if (is_valid_id($remove)) { do_mysql_query("DELETE FROM bans WHERE id=".$remove) or sqlerr(); write_log("Ban ".$remove." was removed by ".$CURUSER['id']." (".$CURUSER['username'].")"); } if ( ($_SERVER["REQUEST_METHOD"] == "POST") && (get_user_class() >= UC_ADMINISTRATOR) ) { $first = trim($_POST["first"]); $last = trim($_POST["last"]); $comment = trim($_POST["comment"]); $hostname = mysql_escape_string( htmlspecialchars( trim($_POST["hostname"]) ) ); if (!$first || !$last || !$comment || !$hostname) stderr( _("Error"), "Missing form data."); $first = ip2long($first); $last = ip2long($last); if ($first == -1 || $last == -1) stderr( _("Error"), _("Bad IP address.") ); $comment = mysql_escape_string( htmlspecialchars($comment) ); $insert_ban_sql = sprintf("INSERT INTO bans (added, addedby, first, last, comment, hostname) VALUES (%s, %u, %u, %u, '%s', '%s')", 'NOW()', $CURUSER['id'], $first, $last, $comment, $hostname); do_mysql_query($insert_ban_sql) or sqlerr(__FILE__,__LINE__); header("Location: ".$BASEURL.$_SERVER['REQUEST_URI']); die; } ob_start("ob_gzhandler"); $res = do_mysql_query("SELECT * FROM bans ORDER BY added DESC") or sqlerr(); stdhead( _("Bans") ); print("
"._('Nothing found')."
"); else { print("Added | "._('First IP')." | "._('Last IP')." | "._('Hostname')." | ". ""._('By')." | "._('Comment')." | "._('Remove')." |
$arr[added] | $arr[first] | $arr[last] | $arr[hostname] | $a2[username]". " | $arr[comment] | Remove |