mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
getip() real by default
This commit is contained in:
@@ -49,7 +49,7 @@ function validip($ip)
|
||||
else return false;
|
||||
}
|
||||
|
||||
function getip() {
|
||||
function getip($true = true) {
|
||||
if (isset($_SERVER)) {
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && validip($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
@@ -67,7 +67,9 @@ function getip() {
|
||||
$ip = getenv('REMOTE_ADDR') ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($true) {
|
||||
return strstr($ip, ",", true);
|
||||
}
|
||||
return $ip;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user