$banselect = array(); $reports = array(); $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);
// Get the individual ban in question $single_ban_assoc = $db->getbanfromid($_GET['banselect']); $sm->assign("ban", $single_ban_assoc, $sm); // Next we fetch all history for the ban. // Substitute in 0 for the subnets $ip3 = 0; if ($single_ban_assoc['ip_octet3'] > -1) { $ip3 = $single_ban_assoc['ip_octet3']; } $ip4 = 0; if ($single_ban_assoc['ip_octet4'] > -1) { $ip4 = $single_ban_assoc['ip_octet4']; } $ip = ip2long($single_ban_assoc['ip_octet1'] . "." . $single_ban_assoc['ip_octet2'] . "." . $ip3 . "." . $ip4); // Get history for the IP $rawhist = $db->getiphistory($ip); if ($rawhist != null) { $banhistory = array(); foreach ($rawhist as $hist) { $banhistory[] = array("ip1" => $hist['ip_octet1'], "ip2" => $hist['ip_octet2'], "ip3" => $hist['ip_octet3'], "ip4" => $hist['ip_octet4'], "id" => $hist['id'], "publicreason" => $hist['publicreason'], "privatereason" => $hist['privatereason'], "adminreason" => $hist['adminreason'], "postdata" => $hist['postdata'], "duration" => $hist['duration'], "bantime" => $hist['bantime'], "bannedby" => $hist['bannedby'], "unbaninfo" => $hist['unbaninfo']); } } else { $banhistory = null; } $sm->assign("banhistory", $banhistory); } else { $rawbans = $db->getallbans(); if ($rawbans != null) { $bans = array(); foreach ($rawbans as $ban) { $bans[] = array("ip1" => $ban['ip_octet1'], "ip2" => $ban['ip_octet2'], "ip3" => $ban['ip_octet3'], "ip4" => $ban['ip_octet4'], "id" => $ban['id'], "publicreason" => $ban['publicreason'], "privatereason" => $ban['privatereason'], "adminreason" => $ban['adminreason'], "postdata" => $ban['postdata'], "duration" => $ban['duration'], "bantime" => $ban['bantime'], "bannedby" => $ban['bannedby']);