Reply to Re: get client IP problem - REMOTE_ADDR

Your name:

Reply:


Posted by Pro N00b on 10/21/80 11:12

Tony Wong wrote:
> Pro N00b <pron00b@yorn.niroj.com.INVALID.DOMAIN.SO.REMOVE.CAPS> wrote in message news:<424d7025$0$151$e4fe514c@news.xs4all.nl>...
>
>>Tony Wong wrote:
>>
>>>Philip Hallstrom <news1@philip.pjkh.com> wrote in message news:<slrnd4o4uo.1kdk.news1@wolf.pjkh.com>...
>>>
>>>
>>>>On 2005-03-31, Tony Wong <tonywonghs@yahoo.com> wrote:
>>>>
>>>>
>>>>>Hi, I have a problem with my server A that retrieving proxy server IP
>>>>>instead of client machine IP. Below is the code,
>>>>>
>>>>>$IPaddress=$REMOTE_ADDR;
>>>>>print $IPaddress . "<br>";
>>>>>
>>>>>
>>>>>But I have no problem with the same code in my server B to retrieve
>>>>>client IP. Would there be a bug of php version?
>>>>>
>>>>>Server A : PHP version 4.3.2
>>>>>Server B : PHP version 4.3.10
>>>>>
>>>>>I tried the following code too but no clue,
>>>>>
>>>>>if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
>>>>> $realip = getenv( 'HTTP_X_FORWARDED_FOR' );
>>>>>} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
>>>>> $realip = getenv( 'HTTP_CLIENT_IP' );
>>>>>} else {
>>>>> $realip = getenv( 'REMOTE_ADDR' );
>>>>>}
>>>>
>>>>Try doing:
>>>>
>>>>print_r($_SERVER);
>>>>
>>>>and then looking for what you *know* to be the client IP, then just use
>>>>that if it exists.
>>>>
>>>>Good luck!
>>>
>>>
>>>I have tried "print_r($_SERVER);", but still cannot find any value of
>>>client IP. This is weird, please help! Thanks!
>>
>>Then your proxy doesn't forward your IP.. There's nothing you can do
>>about that, except maybe mailing the proxy server admin.
>
>
> Do you mean client machine proxy server?
I mean a proxy between you and server A

> But then why I can get my
> client machine IP from server B?
There probably is no proxy between you and server B

> I have even tried PERL script, and it
> gives same problem here, so it seems like not PHP problem anymore,
It can't even be a PHP problem, because PHP only gives you the IP the
request came from. A proxy reformats your request, so if there's a proxy
between you and the server, PHP will see the IP of the proxy. That's the
whole proxy idea; hiding who's behind it.

> would there be Apache server issue? Thanks!
Possible. I don't know anything about the servers you are using, and
what route your request has to take, but there is _something_ between
you and the php parser. It can be apache reformatting the request, in
that case the IP you should see in your script is 127.0.0.1. If the IP
in your scripts matches 10.x.x.x or 192.168.x.x then there's a proxy in
the network of your server, and if the IP doesn't match, it's a proxy
somewhere on the internet

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация