Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic


by sOKOle (Acolyte)
on Aug 14, 2001 at 14:08 UTC ( #104720=perlquestion: print w/replies, xml ) Need Help??

sOKOle has asked for the wisdom of the Perl Monks concerning the following question:

To check user IP we have the enviroment table $ENV: $address=$ENV{REMOTE_ADDR}; but if the user connects through LAN his IP is always Does anybody knows what should I do to get the user real IP, even when he connects through LAN? RSVP sOKOle

Replies are listed 'Best First'.
Re: IP
by blakem (Monsignor) on Aug 14, 2001 at 14:35 UTC
    There are various setups that will cause the remote_addr to be the local machine ( Most that I've seen will set some other environment variable before overwriting $ENV{REMOTE_ADDR}, You might try $ENV{HTTP_PROXY} $ENV{FORWARDED_FOR} or $ENV{X_HTTP_FORWARD}. Since it varies between systems, my advice would be to just dump your %ENV and take a look, like so:

    print "$_ => $ENV{$_}\n" for (keys %ENV);


Re: IP addresses
by RatArsed (Monk) on Aug 14, 2001 at 14:17 UTC
    Are your users connecting via a proxy, on the same host? the remote address is always the IP address of the remote socket.


      via a proxy I think, anyway the problem remains, regardles how do they connect I always see the same :( sOKOle

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://104720]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2020-05-25 09:28 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (145 votes). Check out past polls.