mirror of https://github.com/itflow-org/itflow
Update functions.php
Return IP if running from behind Cloudflare.
This commit is contained in:
parent
c1ff2011a4
commit
42c2d8109d
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue