Answer the question
In order to leave comments, you need to log in
How to find the user's ip?
There was always a standard code
function get_ip(){
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip=$_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
Answer the question
In order to leave comments, you need to log in
The original visitor IP address appears in an appended HTTP header called CF-Connecting-IP . By following our webserver instructions, you can log the original visitor IP address at your origin server.
$_SERVER["HTTP_CF_CONNECTING_IP"]
There has always been a standard shit code that lamers all over the world diligently rewrite from each other, not understanding its meaning. Only
$ip=$_SERVER['REMOTE_ADDR']; should be left of it;
and the rest of the heresy in the trash.
Read here: phpfaq.ru/tech/ip
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question