#!/usr/bin/perl #This cgi program stores hit data in a file to be retrieved by the #stats program at a later time. require "setup.dat"; #print null graphic while this performs background data storage print "Location:$imageurl/nil.gif\n\n"; # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/~!/ ~!/g; $FORM{$name} = $value; } ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); 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\n$min\n$sec\n$month\n$mday\n$year"; &log; sub log { open(LOG,">>$basepath$logfile"); #date&time print LOG "$date\n"; #Remote Host print LOG "$ENV{'REMOTE_HOST'}\n"; #Remote IP print LOG "$ENV{'REMOTE_ADDR'}\n"; #referring page print LOG "$ENV{'HTTP_REFERER'}\n"; #Type of Browser print LOG "$ENV{'HTTP_USER_AGENT'}\n"; close (LOG); }