#!/usr/bin/perl $log_file = "log.txt"; $http_referer = $ENV{'HTTP_REFERER'}; $remote_addr = $ENV{'REMOTE_ADDR'}; $http_user_agent = $ENV{'HTTP_USER_AGENT'}; $request_uri = $ENV{'REQUEST_URI'}; $date = `date`; $whoislink = "http://www.dnsstuff.com/tools/whois.ch?ip=$remote_addr"; if ($ENV{'HTTP_REFERER'} eq "") {$http_referer = "None";} $ip = $ENV{'REMOTE_ADDR'}; @digits = split (/\./, $ip); $address = pack ("C4", @digits); $host = gethostbyaddr ($address, 2); $log_vars="$http_referer|$remote_addr|$host|$http_user_agent|$request_uri|$date"; open (LOG, ">>$log_file"); print LOG "Referrer: $http_referer\n"; print LOG "Remote Address: $remote_addr\n"; print LOG "Host: $host\n"; print LOG "User Agent: $http_user_agent\n"; print LOG "Request URI: $request_uri\n"; print LOG "Date: $date\n\n\n"; close (LOG); @Form = split(/&/,$request_uri); foreach $i (@Form) { ($name, $value) = split(/=/,$i); $Form{$name} = $value; } if ($Form{'mode'} eq "silent") { print "Content-Type: text/html\n\n"; } if ($Form{'mode'} eq "gif") { $im = 's.gif'; print "Content-type: image/gif\n\n"; if (open(IMG , "<$im")){ binmode IMG ; print $buf while(read IMG,$buf,1); close IMG ; } } else { print "Content-Type: text/html\n\n"; print "\n\nServer Logs\n"; print "\n"; print "\n"; print "\n"; print "
\n";
	print "Referrer: $http_referer
"; print "Remote Address: $remote_addr
"; print "Host: $host
"; print "User Agent: $http_user_agent
"; print "Request URI: $request_uri
"; print "WHOIS info
"; print "
\n"; }