$boards = array(); // Perform some IP lookup things if requested if (isset($_GET['action']) && $_GET['action'] == "iplookup") { $single_ip = trim($_GET['ip']); if ($single_ip != "") { $longip = ip2long($single_ip); // Make sure it's valid if ($longip === false) { THdie("Invalid IP of '" . $single_ip . "' provided."); } // Get recent reports $reports = $db->recentreportsfromip($longip); // Get ban history $banhistory = $db->getiphistory($longip); // Get current ban information, if any $banselect = $db->getban($longip, false); // don't clear bans (hence the 2nd parameter) // Get recent posts $posthistory = $db->recentpostsfromip($longip); // Set images for each post foreach ($posthistory as $post) { $post['images'] = $db->getimgs($post['imgidx']); } // Get the boards array to show folders $boards = $db->getboard(); // No parameters means everything gets fetched } } $sm = sminit("adminlookup.tpl", null, "_admin", true); // Admin mode means NO caching. (and we provided a null id anyway) // These can be pretty big, so we're going to assign by reference.
header("Location: " . THurl . "admin.php?a=x"); } elseif ($_GET['t'] == "ux") { $reason = $_SESSION['username'] . " via admin ban panel"; if (isset($_GET['reason'])) { $reason = $_GET['reason']; } $bans = $db->getallbans(); foreach ($bans as $ban) { if ($_POST['del' . $ban['id']]) { $db->delban($ban['id'], $reason); } } header("Location: " . THurl . "admin.php?a=x"); } elseif ($_GET['t'] == "lx") { if (isset($_POST['ip'])) { $ban_info = $db->getban($_POST['ip']); // Did we find at least one ban? // If so, redirect to the ban ID of the first element in the array. if (count($ban_info) > 0) { header("Location: " . THurl . "admin.php?a=x&banselect=" . $ban_info[0]['id']); } else { header("Location: " . THurl . "admin.php?a=x"); // failure } } else { header("Location: " . THurl . "admin.php?a=x"); // even worse failure } } elseif ($_GET['t'] == "ac") { if ($_POST['capcodefrom'] == null || $_POST['capcodeto'] == null) { THdie('Invalid field provided.');