#!c:/perl/bin/perl # # logbus.pl written by Doug Hardt in November, 1998 # Email : dhardt@email.msn.com # http://www.hardts.net # # This relies on SSI (Server Side Includes). # I found this site helpful: # http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html#Vars # #******************* Variables ************************************** # You would change these: $logfile = "d:/inetpub/hardts/cgi-bin/buslog.dat"; $my_addr = "134.113.200.93"; $my_addr1 = "208.253.194.211"; #******************* Code ************************************** # Get the date ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); # You might change, I adjust for East vs West Coast for my server if ($hour < 10) {$hour = $hour + 3;} else {$hour = $hour - 9;}; if ($sec < 10) {$sec = "0$sec";} if ($min < 10) {$min = "0$min";} if ($hour < 10) {$hour = "0$hour";} if ($mon < 10) {$mon = "0$mon";} if ($mday < 10) {$mday = "0$mday";} $month = ($mon + 1); @months = ("January","February","March","April","May","June","July","August","September","October","November","December"); $date = "$hour\:$min\:$sec $month/$mday/$year"; #### Call the log &log unless ($ENV{'REMOTE_HOST'} eq $my_addr or substr($ENV{'REMOTE_HOST'},0,11) eq $my_addr1 ); sub log { print "\n"; if (! open(LOG,">>$logfile")) { print "Content-type: text/html\n\n"; print "Couldn't open $logfile..\n"; exit; } print LOG "$date, $ENV{'REMOTE_HOST'} from $ENV{'HTTP_REFERER'} using $ENV{'HTTP_USER_AGENT'}.\n"; close (LOG); }