#!/usr/bin/perl 

$url=$ENV{'QUERY_STRING'};
$referer=$ENV{'HTTP_REFERER'};

$logfile="/var/www/customers/tubenet/public_html/cgi/datat/log.txt";
$errorfile="/var/www/customers/tubenet/public_html/cgi/datat/errors.txt";

chop($shortdate=`date +'%H:%M:%S %m-%d-%Y'`);
open (LOG, ">>$logfile") || open(LOG, ">>$errorfile");
print LOG "$shortdate | ";
print LOG "$ENV{'REMOTE_ADDR'} | "; 
print LOG "$ENV{'REMOTE_HOST'} | ";
print LOG "$ENV{'QUERY_STRING'} | ";
print LOG "$ENV{'HTTP_REFERER'}\n";
close (LOG);
if ($url)
{
  print "Location: $url\n\n\n";
} 
else 
{
  print "Location: http://www.tubenet.org.uk/\n\n";
}; 
exit;


