>Hi there, > >I'm looking for a way to get a perl script server-side include to get >the IP adress of the person loading the page. Is this possible? If so, >how? And anyways, how do I get the IP adress of someone running a script? > >Thanx, > >Sveinbjorn Thordarson >Reykjavik, Iceland Hello Sveinbjorn, what you are probably looking for are the CGI environment variables. The Common Gateway Interface (CGI) is a standard for external gateway programs to interface with information servers such as HTTP servers. Each time your (CGI-) Perl script gets called by the web-server, the server uses environment variables to send your script its parameters. (It doesn't matter if a client requests the URL corresponding to your CGI script or if your script gets called via a SSI execute statement.) In this case, the variables REMOTE_ADDR and/or REMOTE_HOST are what you want: " € REMOTE_HOST The hostname making the request (for example www.acompany.com). If the server does not have this information, it should set REMOTE_ADDR and leave this unset. € REMOTE_ADDR The IP address of the remote host making the request. " In your Perl script, you may use functions exported by the modul CGI.pm (see the heading 'FETCHING ENVIRONMENT VARIABLES' in CGI.pm) to get the value of these variables. You may also access these variables directly. In a Perl CGI script, the environment variables are always available in the hash %ENV. So $remote_host_name = $ENV{REMOTE_HOST}; $remote_host_addr = $ENV{REMOTE_ADDR}; is what you want. The following for-loop gives you a sorted list of all parameters: foreach $key (sort keys %ENV) { printf("%-20s %s\n", $key, $ENV{$key}); }#end for Take a look at the DEMO.cgi/DEMO.acgi files in the 'MacPerl CGI' folder. If you want to learn more about the CGI standard, take a look at the introduction from NCSA at <http://hoohoo.ncsa.uiuc.edu/cgi/overview.html> and the CGI tutorial at <http://lpage.com/cgiexample.html>. You may also want to read the very informative article "Using MacPerl for CGI Programming" by David Steffen in the PerlMonth online magazine (<http://www.perlmonth.com/columns/mac_perl/mac_perl.html?issue=11>). Best regards --Thomas # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org