I'm using two different ways to get the ip address of a visitor to my site. The first one is the most common way $ip = $_SERVER['REMOTE_ADDR'];
The second way I am using to see if anyone is hiding behind a proxy. When I try hiding my ip as a test it still comes up the same as if I wasn't hiding it.
if (getenv(HTTP_X_FORWARDED_FOR)) {
$ip = getenv(HTTP_X_FORWARDED_FOR);
} else {
$ip= getenv(REMOTE_ADDR);
}
Most of the time I am getting the same exact ip address from both. Occasionally I will see two different ip addresses from the same user but both ip's indicate that they are from the same destination. I would like to know the exact ip address of my visitors to see if they are hiding their true location or not. Could someone explain what I am doing wrong, which is more accurate or what changes I could make? Thanks.