dblink, " SELECT id, username FROM ".TB_PREFIX."users WHERE id = $uid LIMIT 1 "); if(!$userCheck || mysqli_num_rows($userCheck) == 0) { $error = "This user does not exist!"; } else { // ========================= // CHECK ALREADY ACTIVE BAN // ========================= $check = mysqli_query($database->dblink, " SELECT id FROM ".TB_PREFIX."banlist WHERE uid = $uid AND active = 1 LIMIT 1 "); if(mysqli_num_rows($check) > 0) { $error = "User is already banned!"; } else { $user = mysqli_fetch_assoc($userCheck); $name = $user['username']; $end = ($time > 0) ? (time() + $time) : 0; // ========================= // INSERT BAN (ACTIVE) // ========================= $currentTime = time(); $stmt = $database->dblink->prepare(" INSERT INTO `".TB_PREFIX."banlist` (uid, name, reason, time, end, admin, active) VALUES (?, ?, ?, ?, ?, 0, 1) "); if ($stmt) { // i = integer, s = string $stmt->bind_param("issii", $uid, $name, $reason, $currentTime, $end); $stmt->execute(); $stmt->close(); } else { $error = "Database error (ban insert): " . $database->dblink->error; } // ========================= // BLOCK USER ACCESS // ========================= if (empty($error)) { $stmt2 = $database->dblink->prepare(" UPDATE `".TB_PREFIX."users` SET access = 0 WHERE id = ? LIMIT 1 "); if ($stmt2) { $stmt2->bind_param("i", $uid); $stmt2->execute(); $stmt2->close(); } else { $error = "Database error (access update): " . $database->dblink->error; } } if (empty($error)) { $success = "User has been banned successfully!"; } } } } } // ========================= // ACTIVE BANS // ========================= $bannedUsers = $admin->search_banned(); // ========================= // HISTORY (inactive bans) // ========================= $banHistory = mysqli_query($database->dblink, " SELECT * FROM ".TB_PREFIX."banlist WHERE active = 0 ORDER BY id DESC LIMIT 50 "); ?>
Ban
User ID
Reason
Duration
getUserField($b['uid'],'username',0); if($name == '') { $name = $b['name']; $link = "[".$name."]"; } else { $link = ''.$name.''; } $end = $b['end'] ? date("d.m.y H:i",$b['end']) : '*'; echo ' '; } } else { echo ''; } ?>
Active Bans ()
Username Length Reason
'.$link.' '.date("d.m.y H:i",$b['time']).' - '.$end.' '.$b['reason'].'
No active bans


0) { while($h = mysqli_fetch_assoc($banHistory)) { $end = $h['end'] ? date("d.m.y H:i",$h['end']) : '*'; echo ' '; } } else { echo ''; } ?>
Ban History (Inactive)
Username Length Reason
'.$h['name'].' '.date("d.m.y H:i",$h['time']).' - '.$end.' '.$h['reason'].'
No ban history