[Melbourne-pm] finding the ip address of the web client

Leigh Sharpe lsharpe at pacificwireless.com.au
Mon Feb 9 16:34:03 PST 2009

%ENV{'REMOTE_ADDR '} should contain the IP address of the client. Try
print "content-type:text/html\n\n<html><body>\n";
        print "$_ = $ENV{$_}<BR>\n";
print "</body></html>\n";


You should see your client IP address in listed.

From: melbourne-pm-bounces+lsharpe=pacificwireless.com.au at pm.org
[mailto:melbourne-pm-bounces+lsharpe=pacificwireless.com.au at pm.org] On
Behalf Of Andrew Dent
Sent: Tuesday, 10 February 2009 11:09 AM
To: melbourne-pm at pm.org
Subject: [Melbourne-pm] finding the ip address of the web client


I'm not sure if this is possible. 

We have some internal web based reports (Perl with the CGI module) that
run queries on an internal Ingres database server (HPUX & Apache). 
The server has databases on it that hold data for all of our offices
throughout Asia. 
At the moment any employee in any of our offices globally can run the
reports for any other office. 

I'd like to know if there is a way to restrict this based on the country
location of the IP address of the webclient that is attempting to run
the report. 
If we can get the IP address, then we can use nslookup to determine the
Full Qualified hostname and figure out which country the webclient is in
(.aus for Australia, .chn for China, .ind for India etc). 
All the data for the offices is identified with codes inside the
database, so mapping from .aus to the Australia office code is easy. 

Can/Should this be done in the Perl code on the Server side, or does
this need to be done in some Java Script (or other such technology) on
the client side?
Either way, does anyone know how to do this?
99% of the web clients will be Windows with a mixture of browsers
limited to IE6, IE7 and Firefox. 


Andrew Dent

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20090210/0ac3f294/attachment.html>

More information about the Melbourne-pm mailing list