|
Posted by Pro N00b on 09/25/76 11:12
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.
Navigation:
[Reply to this message]
|