Skip to content

Commit

Permalink
getip() real by default
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove authored Jan 22, 2024
1 parent 20804be commit 3a3b22e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/globalfunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -67,7 +67,9 @@ function getip() {
$ip = getenv('REMOTE_ADDR') ?? '';
}
}

if ($true) {
return strstr($ip, ",", true);
}
return $ip;
}

Expand Down

0 comments on commit 3a3b22e

Please sign in to comment.