Re: RE: [PHP] HTTP_X_FORWARDED_FOR?
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: > > > > > 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]
Re: RE: [PHP] HTTP_X_FORWARDED_FOR?
> > 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: > > 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]
RE: [PHP] HTTP_X_FORWARDED_FOR?
> 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: 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]
Re: [PHP] HTTP_X_FORWARDED_FOR?
Yeah, I've tried that and the $HTTP_SERVER_VARS but I keep getting this error: PHP Warning: Undefined index: HTTP_X_FORWARDED_FOR in C:\Web\byenighte\phpinfo.php on line 2 I'm using the recommended php.ini, by the way. Sebbe > > hi > > try something like > > $_SERVER["HTTP_X_FORWARDED_FOR"] > > best regards > attila > > > > > > Hy, > > > > > > [EMAIL PROTECTED] wrote: > > > > > Hi, > > > > > > I just installed IIS 5.0 and PHP 4.1.1 on Win 2000, and I'm wondering > what happened to the HTTP_X_FORWARDED_FOR? I doesn't seem to exist on my > system. Is it just a variable that needs to be changed, or has it been > removed from PHP? Thanks. > > > > > > > > This has something to do with the way you access the machine - > > x-forwarder-for contains the private ip address of your client machine > > when calling the php pages through a proxy. > > It has nothing to do with your php or server side configuration. > > > > henning > > > > > > > > > > -- > > 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] > > > > > -- > 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] > > > 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]
Re: [PHP] HTTP_X_FORWARDED_FOR?
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? Sebbe > > Hy, > > > [EMAIL PROTECTED] wrote: > > > Hi, > > > > I just installed IIS 5.0 and PHP 4.1.1 on Win 2000, and I'm wondering what >happened to the HTTP_X_FORWARDED_FOR? I doesn't seem to exist on my system. Is it >just a variable that needs to be changed, or has it been removed from PHP? Thanks. > > > > This has something to do with the way you access the machine - > x-forwarder-for contains the private ip address of your client machine > when calling the php pages through a proxy. > It has nothing to do with your php or server side configuration. > > henning > > > > > -- > 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] > > > 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]
Re: [PHP] HTTP_X_FORWARDED_FOR?
hi try something like $_SERVER["HTTP_X_FORWARDED_FOR"] best regards attila > > Hy, > > > [EMAIL PROTECTED] wrote: > > > Hi, > > > > I just installed IIS 5.0 and PHP 4.1.1 on Win 2000, and I'm wondering what happened to the HTTP_X_FORWARDED_FOR? I doesn't seem to exist on my system. Is it just a variable that needs to be changed, or has it been removed from PHP? Thanks. > > > > This has something to do with the way you access the machine - > x-forwarder-for contains the private ip address of your client machine > when calling the php pages through a proxy. > It has nothing to do with your php or server side configuration. > > henning > > > > > -- > 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] > -- 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]
Re: [PHP] HTTP_X_FORWARDED_FOR?
Hy, [EMAIL PROTECTED] wrote: > Hi, > > I just installed IIS 5.0 and PHP 4.1.1 on Win 2000, and I'm wondering what happened >to the HTTP_X_FORWARDED_FOR? I doesn't seem to exist on my system. Is it just a >variable that needs to be changed, or has it been removed from PHP? Thanks. This has something to do with the way you access the machine - x-forwarder-for contains the private ip address of your client machine when calling the php pages through a proxy. It has nothing to do with your php or server side configuration. henning -- 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]
[PHP] HTTP_X_FORWARDED_FOR?
Hi, I just installed IIS 5.0 and PHP 4.1.1 on Win 2000, and I'm wondering what happened to the HTTP_X_FORWARDED_FOR? I doesn't seem to exist on my system. Is it just a variable that needs to be changed, or has it been removed from PHP? Thanks. Sebbe 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]
[PHP] HTTP_X_FORWARDED_FOR
On php.net I found this: When you use REMOTE_ADDR for getting the IP of the current user, sometimes you get the IP of the ISP Cache server. When this happens, the HTTP_X_FORWARDED_FOR is also set, it contains the IP of the user. [...] Note that the X-Forwarded for header might contain multiple addresses, comma separated, if the request was forwarded through multiple proxies. [...] My question is: If the X-Forwarded for header contains multiple addresses, comma separated, where do I find the one of the user? (I which order does it contain the adresses?) Do I get the right order (from the last proxies (at the beginning) to the user itself (at the end)) when I do this: $ip_route = $HTTP_SERVER_VARS["REMOTE_ADDR"] . "," . $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]; So that I finally have a chronological sorted list (i know: a string that contains the comma seperated ip-addresses of the users way to me (if they were forwarded by the proxie))? Am I right? Thanks for any coments about this. -- 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]