> Okay, thanks. 'Cause I mean, the REMOTE_ADDR is still there. So you
> mean that the HTTP_X_FORWARDED_FOR isn't working while I'm working
localhost?

REMOTE_ADDR contains the IP of the computer that requested your page.

If it was a proxy doing the request, you'll have the proxy's IP in this
variable, and the IP of the computer that requested the page from the proxy
will be in HTTP_X_FORWARDED_FOR.

This means the best way to grab an IP is with a a function like this:

<?php
function getIP () {
  if (getenv(HTTP_X_FORWARDED_FOR)) {

    $ip = getenv(HTTP_X_FORWARDED_FOR); 
  } else { 
    $ip = getenv(REMOTE_ADDR); 
  }
  return $ip;
}       
?>

I'm unsure what happens with multiple proxies, and I'd be interested to know
- do you get an array of HTTP_X_FORWARDED_FORs? Do you just get the first or
the last?

Cheers
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to