On Thursday 10 January 2002 19:36, [EMAIL PROTECTED] stuffed this into my mailbox:
Please note that not all proxies will fill in HTTP_X_FORWARDED_FOR. Some will obscure it others will not fill it in at all, either due to privacy or to conseal things. > > > 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. > > Thanks, never really knew that. > > > 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; > > } > > ?> > > Yeah, that's what I do. ;) > > > 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? > > Have no idea... > > > Cheers > > Jon > > .................................... > Get your own free email account from > http://www.popmail.com -- 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]