require "include/bittorrent.php"; dbconn(false); loggedinorreturn(); if( get_user_class() < UC_MODERATOR) stderr( _("Error"), _("Permission denied.")); if ($_SERVER["REQUEST_METHOD"] == "POST" && get_user_class() >= UC_ADMINISTRATOR) { $first = trim($_POST["first"]); $last = trim($_POST["last"]); $comment = trim($_POST["comment"]); $hostname = trim($_POST["hostname"]); if (!$first || !$last || !$comment) stderr( _("Error"), "Missing form data."); $first = ip2long($first); $last = ip2long($last); if( ($first == -1 || $last == -1) || ($first === false || $last === false) ) stderr( _("Error"), _("Bad IP address.") ); $comment = sqlesc($comment); $add_ban = sprintf("INSERT INTO bans (added, addedby, first, last, comment) VALUES (NOW(), %u, %u, %u, '%s')", $first, $last, $comment); do_mysql_query($add_ban) or sqlerr(__FILE__, __LINE__); header("Location: ".$BASEURL.$_SERVER['REQUEST_URI']); die; } ob_start("ob_gzhandler"); stdhead("Bans2"); print("