// This function returns the Client side IP Address
function getIP(){
$ip;
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "UNKNOWN";
return $ip;
}
But the thing is My machine is running behind proxy, and it is not giving me client IP, it is always givin me REMOTE_ADD ie 127.0.0.1. Is there any way to get the real IP of my machine, I think There is something wrong in APACHE server. how can i update the env var in apache.
Last edited by poddar_ravi on Thu Aug 31, 2006 6:12 am, edited 1 time in total.
But the thing is if i will hardcode this thing, this will not work in the situation where i have to track the user's IP and according to Tracked IP i have to generate reports.
I have not changed anything on SERVER SIDE, i have changed it on the client side only (I am using Mozilla).
Actually i am working in a Software Company, so my PC is behind proxy. Whenever i try to capture my Public IP address, I get only REMOTE_ADDR. I want to capture my Public IP. I am using PHP and apache.
If the proxy does not add the ip the webserver is unable to determine the client's ip.
The connection to the webserver is established by the proxy and therefore remote_addr shows the ip of the proxy.
Last edited by volka on Fri Sep 01, 2006 6:44 am, edited 1 time in total.
You can get the ip of their proxy/nat server.
But no, I haven't heard of a browser that sends its own ip as request header. Maybe you can find an addon for mozilla doing that. And maybe then the proxy filters it out again - it really depends on the proxy's configuration