#!/usr/bin/perl

###########################################
## RushHour 1.0                          ##
## Written by Janis E. Kenderdine        ##
## http://www.fifedrum.org/fifer         ##
## February 10, 2005                      ##
###########################################

#############CUSTOMIZE HERE ###############

## Uncomment this if your home directory is
## http://www.yourdomain.com/ (the site root)
## and give the home directory a displayname
#$homedir = "Home";

################### STOP ##################
##Nothing below needs to be touched
			
print "content-type:text/html\n\n";		

$user_agent = $ENV{'HTTP_USER_AGENT'};
$remote_ip = $ENV{'REMOTE_ADDR'};
$timestamp = `date '+%T'`;
chomp $timestamp;
$document = $ENV{'DOCUMENT_URI'};
$referrer = $ENV{'HTTP_REFERER'};

$thisdir = `pwd`;
chomp $thisdir;
$datadir = "$thisdir/data";
$year = `date +%Y`; chomp $year;
$month = `date +%m`; chomp $month;
$day = `date +%d`; chomp $day;

if (`ls $datadir/$year` eq "") { `mkdir $datadir/$year`; }
if (`ls $datadir/$year/$month` eq "") { `mkdir $datadir/$year/$month`; }
$filename = "$year/$month/$day"; 
open (DUMP, ">>$datadir/$filename") || open (DUMP, ">$datadir/$filename");
print DUMP "$remote_ip\t$timestamp\t$referrer\t$document\t$user_agent\n";
close DUMP;

exit;
