use Socket;
use Strict;
print "Content-Type: text/html; charset=iso-8859-1\n";
print "Pragma: no-cache\n\n";
print <<enough;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1">
<title>Output of a sample CGI Script</title>
<meta name="robots" content="noindex,nofollow">
</head>
<body style="background: #CCFFFF;">
enough
my $ipad = $ENV{'REMOTE_ADDR'};
my $name = ip2name($ipad);
my $syst = $ENV{'HTTP_USER_AGENT'};
print "<p>This script was run on request that came from a computer with the IP address of <code>$ipad</code>.</p>\n";
print "<p>I looked it up and found out that it actually is <code>$name</code>.\n</p>";
print "<p>I also know that your computer is running <code>$syst</code>.\n</p>";
print <<enough;
</body>
</html>
enough
exit(0);
my $ad=$_[0] or return("undefined");
return (gethostbyaddr(pack('C4', split(/\./, $ad)), AF_INET) or $ad);
}