I have coded a small tracker to a company site that grabs the users session visits and is supposed to grab the IP for the user (so that I can filter out visits from within the company for stats).
I am using the following code to get the users IP but nomatter where I bring the page up from (home or work) it only returns the IP of the server where the site is hosted.
$SessionId = session_id();
if(getenv("HTTP_CLIENT_IP")) {
$ip = getenv("HTTP_CLIENT_IP");
} elseif(getenv("HTTP_X_FORWARDED_FOR")) {
$ip = getenv("HTTP_X_FORWARDED_FOR");
} else {
$ip = getenv("REMOTE_ADDR");
}
Any suggests to get this to work would be helpful.
Thanks,
jasonn.