getUserArray($session, 1);
if (!$admin || (int)$admin['access'] !== 9) {
die('
Access Denied: You are not Admin!
');
}
// ---------------------------------------------------------------------------
// Calcul protecție
// ---------------------------------------------------------------------------
$time = time();
$protection = $days > 0 ? $time + ($days * 86400) : 0;
$database->query("UPDATE " . TB_PREFIX . "users SET protect = $protection WHERE id = $id");
// ---------------------------------------------------------------------------
// Log admin
// ---------------------------------------------------------------------------
$adminId = (int)$_SESSION['id'];
$time = time(); // asigură-te că $time e definit înainte
// FIX: username + ID formatat
$targetName = $database->getUserField($id, 'username', 0) ?: 'UID '.$id;
$targetNameSafe = htmlspecialchars($targetName, ENT_QUOTES, 'UTF-8');
$logText = "Set protection for user $targetNameSafe to $days days";
$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=player&uid=" . $id);
exit;
?>