feat: IP ban support (#185) (#188)

This commit is contained in:
Ferywir
2026-06-09 14:15:27 +02:00
committed by GitHub
parent d30bef0a40
commit 20804d9182
12 changed files with 501 additions and 9 deletions
+8 -1
View File
@@ -107,6 +107,13 @@ function __construct() {
$this->access = $this->logged_in ? $database->getUserField($this->uid, "access", 1) : 0;
}
// === IP BAN ENFORCEMENT (issue #185) - DUPA ce avem access ===
// Admins / Multihunters are never blocked by an IP ban (avoid self-lockout).
// The admin panel (Admin/admin.php) does not bootstrap Session, so it stays reachable.
if ((int)$this->access < (defined('MULTIHUNTER') ? MULTIHUNTER : 8)) {
\App\Utils\IpResolver::enforce($database);
}
// === MAINTENANCE CHECK - DUPA ce avem access ===
$maint = $database->getMaintenance();
if($maint['active'] == 1 && $this->access < 9) {
@@ -165,7 +172,7 @@ function __construct() {
$database->updateUserField($user_sanitized, "sessid", $_SESSION['sessid'], 0);
}
$logging->addLoginLog($dbarray['id'], $_SERVER['REMOTE_ADDR']);
$logging->addLoginLog($dbarray['id'], \App\Utils\IpResolver::getClientIp() ?? ($_SERVER['REMOTE_ADDR'] ?? '0.0.0.0'));
if ($dbarray['id'] == 1) {
header("Location: nachrichten.php");