getUserArray($session, 1);
if (!$admin || (int)$admin['access'] !== 9) {
die('
Access Denied: You are not Admin!
');
}
// ---------------------------------------------------------------------------
// Input
// ---------------------------------------------------------------------------
$reason = trim($_POST['unbanreason'] ?? '');
if ($reason === '') {
header("Location: ../../../Admin/admin.php?p=ban&e=noreason");
exit;
}
$reasonEsc = $database->escape($reason);
$time = time();
$adminId = (int)$session;
// ---------------------------------------------------------------------------
// Unban
// ---------------------------------------------------------------------------
$database->query(
"UPDATE " . TB_PREFIX . "banlist
SET active = 0, end = $time
WHERE reason = '$reasonEsc' AND active = 1"
);
// ---------------------------------------------------------------------------
// Log admin
// ---------------------------------------------------------------------------
$logText = "Mass unban for reason='$reasonEsc'";
$logEsc = $database->escape($logText);
$database->query(
"INSERT INTO " . TB_PREFIX . "admin_log (`id`, `user`, `log`, `time`) " .
"VALUES (0, '$adminId', '$logEsc', $time)"
);
header("Location: ../../../Admin/admin.php?p=ban&u=1");
exit;
?>