#!/usr/local/bin/perl # Adjust the above line to find perl on your system # test-env.cgi Copyright 1995 by David Efflandt efflandt@xnet.com # May be freely distributed and modified. # Author is not responsible for its use. # Note: Variable list will differ if run locally from UNIX # Print content-type for HTTP/1.0 compatibility print "Content-type: text/html\n\n"; # Print title and initial heading print "Environment\n"; print "

List of all Environmental Variables


\n"; # Sort and print all environmental variables foreach $key (sort keys(%ENV)) {print "$key = $ENV{$key}

\n";} # Resolve REMOTE_HOST into name $ip_address = $ENV{'REMOTE_ADDR'}; @numbers = split(/\./, $ip_address); $ip_number = pack("C4", @numbers); ($name) = (gethostbyaddr($ip_number, 2))[0]; if (defined $name) {print "


REMOTE_HOST resolves to: $name";} # Print closing to point to your home page print "

\n"; print 'Return to my home page.

'; exit;