Merge pull request #480 from jcpit/patch-1

Update functions.php
This commit is contained in:
Johnny 2022-08-12 11:03:38 -04:00 committed by GitHub
commit b10e493e12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -58,16 +58,19 @@ function get_user_agent() {
}
function get_ip() {
if(defined("CONST_GET_IP_METHOD")){
if(CONST_GET_IP_METHOD == "HTTP_X_FORWARDED_FOR"){
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
else{
$ip = getenv('REMOTE_ADDR');
$ip = $_SERVER["HTTP_CF_CONNECTING_IP"] ?? $_SERVER['REMOTE_ADDR'];
}
}
else{
$ip = getenv('REMOTE_ADDR');
$ip = $_SERVER["HTTP_CF_CONNECTING_IP"] ?? $_SERVER['REMOTE_ADDR'];
}
return $ip;