client ip changes

This commit is contained in:
Tower committed 2026-07-06 22:30:24 +02:00
1 parent 388f9b8f0d
commit a066c59576
1 file changed
+10 -6
+10 -6
View File
@@ -117,16 +117,20 @@ class getSpecificData {
}
}
public function getClientIP(): string {
public function getClientIP(): string
{
if (PHP_SAPI === 'cli') {
return 'CLI';
}
$xff = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? null;
if ($xff) {
if (!empty($xff)) {
$ips = array_map('trim', explode(',', $xff));
$clientIp = $ips[0];
return $clientIp;
} else {
return $_SERVER['REMOTE_ADDR'];
return $ips[0];
}
return $_SERVER['REMOTE_ADDR'] ?? 'UNKNOWN';
}
public function getRequestTime(): string {