#!/usr/bin/perl
$cFile="cgi-bin/counterfile";
$logFile="cgi-bin/logfile";
open(OFILE,"$cFile");
$ctr=<OFILE>;
$ctr++;
close(OFILE);
open(WFILE,">$cFile") || `cat /dev/null > $cFile;chmod 666 $cFile`;
print WFILE $ctr;
close(WFILE);
$date=`date +%A%t%B%%%d%t%Y`;
$date=~s/ /, /gi;
$date=~s/%/ /gi;
#Again, this is customizeable
#current settings: 12hour format "hour:minute am/pm"
$time=`date +%l%%%M%t%p`;
$time=~s/%/:/gi;
$time=~s/ / /gi;
#Get rid of annoying returns(asthetics)
chomp $date;
chomp $time;
#Record to your log File
open(LOGGER,">>$logFile") || `cat /dev/null > $logFile;chmod 666 $logFile`;;
print LOGGER "\nNumber $ctr showed up on $date at $time from $ENV{REMOTE_ADDR}\n";
close(LOGGER);
#Checks to see if host can be resovled
$res=$ENV;
if($res eq ""){
$response="";
}elsif($res ne ""){
$response="Resolved: $res";
}
#This is the only output from the script, just to let them know you're watching
print "<center>You have been logged from: $ENV{REMOTE_ADDR}<br>$res</center>";