<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<STYLE>BODY {
        FONT-SIZE: 12px; FONT-FAMILY: Arial, Helvetica, sans-serif
}
</STYLE>
<META content="MSHTML 6.00.6000.16788" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=171442800-10022009><FONT
size=2>%ENV{'REMOTE_ADDR '} should contain the IP address of the client. Try
this:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=171442800-10022009><FONT
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=171442800-10022009><FONT
size=2>-----</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=171442800-10022009><FONT
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=171442800-10022009><FONT
size=2>#!/usr/bin/perl<BR>print
"content-type:text/html\n\n<html><body>\n";<BR>foreach(keys(%ENV))<BR>{<BR>
print "$_ = $ENV{$_}<BR>\n";<BR>}<BR>print
"</body></html>\n";<BR></FONT></SPAN></DIV>
<DIV><SPAN class=171442800-10022009></SPAN><FONT size=2>------</FONT></DIV>
<DIV><FONT size=2><SPAN class=171442800-10022009></SPAN><BR></FONT> </DIV>
<DIV><SPAN class=171442800-10022009><FONT size=2>You should see your client IP
address in listed.</FONT></SPAN></DIV>
<DIV><SPAN class=171442800-10022009><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=171442800-10022009><FONT size=2>Leigh.</FONT></SPAN></DIV>
<DIV><SPAN class=171442800-10022009></SPAN> </DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
melbourne-pm-bounces+lsharpe=pacificwireless.com.au@pm.org
[mailto:melbourne-pm-bounces+lsharpe=pacificwireless.com.au@pm.org] <B>On Behalf
Of </B>Andrew Dent<BR><B>Sent:</B> Tuesday, 10 February 2009 11:09
AM<BR><B>To:</B> melbourne-pm@pm.org<BR><B>Subject:</B> [Melbourne-pm] finding
the ip address of the web client<BR></FONT><BR></DIV>
<DIV></DIV>G'day<BR><BR>I'm not sure if this is possible. <BR><BR>We have some
internal web based reports (Perl with the CGI module) that run queries on an
internal Ingres database server (HPUX & Apache). <BR>The server has
databases on it that hold data for all of our offices throughout Asia. <BR>At
the moment any employee in any of our offices globally can run the reports for
any other office. <BR><BR>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. <BR>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).
<BR>All the data for the offices is identified with codes inside the database,
so mapping from .aus to the Australia office code is easy. <BR><BR>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?<BR>Either
way, does anyone know how to do this?<BR>99% of the web clients will be Windows
with a mixture of browsers limited to IE6, IE7 and Firefox.
<BR><BR>Cheers<BR><BR>Andrew Dent<BR><BR><BR></BODY></HTML>