$redirect = false; $loggedin = false; $isadmin = false; $returnlink = basename($_SERVER['PHP_SELF']); list($loggedin, $isadmin) = manageCheckLogIn(); if ($loggedin) { if ($isadmin) { if (isset($_GET['rebuildall'])) { $allthreads = allThreads(); foreach ($allthreads as $thread) { rebuildThread($thread['id']); } rebuildIndexes(); $text .= manageInfo('Rebuilt board.'); } elseif (isset($_GET['bans'])) { clearExpiredBans(); if (isset($_POST['ip'])) { if ($_POST['ip'] != '') { $banexists = banByIP($_POST['ip']); if ($banexists) { fancyDie('Sorry, there is already a ban on record for that IP address.'); } $ban = array(); $ban['ip'] = $_POST['ip']; $ban['expire'] = $_POST['expire'] > 0 ? time() + $_POST['expire'] : 0; $ban['reason'] = $_POST['reason']; insertBan($ban); $text .= manageInfo('Ban record added for ' . $ban['ip']); } } elseif (isset($_GET['lift'])) { $ban = banByID($_GET['lift']);
function checkBanned() { $ban = banByIP($_SERVER['REMOTE_ADDR']); if ($ban) { if ($ban['expire'] == 0 || $ban['expire'] > time()) { $expire = $ban['expire'] > 0 ? '<br>This ban will expire ' . date('y/m/d(D)H:i:s', $ban['expire']) : '<br>This ban is permanent and will not expire.'; $reason = $ban['reason'] == '' ? '' : '<br>Reason: ' . $ban['reason']; fancyDie('Your IP address ' . $ban['ip'] . ' has been banned from posting on this image board. ' . $expire . $reason); } else { clearExpiredBans(); } } }