[PHP] Wrong IP address
Greetings, I make use of these: - to get the web IP address for my machine once my PC is connected to Internet.. Anyway, sometime I get the correct IP address, but sometime NOT. Does anyone know why? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Wrong IP address
If your request is going through a proxy, $_SERVER["REMOTE_ADDR"] will contain the ip address for the proxy. The proxy might add a HTTP_X_FORWARDED_FOR header to the request which will contain the ip address of the client to the proxy, which should be where the request originated. It is possible for a request to travel through several proxies and then the HTTP_X_FORWARDED_FOR header will be added several times. $_SERVER['HTTP_X_FORWARDED_FOR'] if exists will contain the ip address of where the request originated if the request was proxied. $_SERVER['HTTP_X_FORWARDED_FOR'] may be an array if the request was proxied several times. Regards, Peter Albertsson -Original Message- From: ascll [mailto:[EMAIL PROTECTED] Sent: den 30 mars 2004 03:13 To: [EMAIL PROTECTED] Subject: [PHP] Wrong IP address Greetings, I make use of these: - to get the web IP address for my machine once my PC is connected to Internet.. Anyway, sometime I get the correct IP address, but sometime NOT. Does anyone know why? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wrong IP address
Hello ascll, Tuesday, March 30, 2004, 2:12:41 AM, you wrote: a> echo($_SERVER["REMOTE_ADDR"]); ?>> a> to get the web IP address for my machine once my PC is connected to a> Internet.. a> Anyway, sometime I get the correct IP address, but sometime NOT. a> Does anyone know why? Firewall? Proxy Server? Anti-Virus/spam/privacy blocker? -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wrong IP address
--- ascll <[EMAIL PROTECTED]> wrote: > echo($_SERVER["REMOTE_ADDR"]); > ?> > > to get the web IP address for my machine once my PC is connected to > Internet.. > > Anyway, sometime I get the correct IP address, but sometime NOT. You're going to have to explain why you think one is right and one is wrong. I can tell you that $_SERVER['REMOTE_ADDR'] always has the "correct" IP of where the HTTP request originated. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Wrong IP address
> From: ascll [mailto:[EMAIL PROTECTED] > Subject: [PHP] Wrong IP address > > to get the web IP address for my machine once my PC is connected to > Internet.. Are you on a highspeed connection or dialup. Dial up connections tend to give a different connection with every connection. Also if you use AOL, they've been known to just up and change your IP address. I know my broadband company can change mine too, if your connecting with on a DHCP server they can change the setting IP address aswell. There are several ways that you can receive a new IP address. Some ISPs offer the ability to purchase a "static" IP, you could check with your company and find out if they offer this. Just an idea! Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php