#!/usr/local/bin/perl

require "/afs/unc/proj/wwwc-f95/lib/cgi-lib.pl";

&ReadParse(*input);

#dbmopen(%counters, "/afs/unc/home/jbs/public_html/counts/counters", 0777);

$file = $input{"file"};
#$counters{"$file"}  += 1;

#dbmclose(%counters);

print "200 ok\n";
#print "Content-type: text/plain\n";
print "Content-type: text/html\n";
#print "Location: /private/images/null_tr.GIF\n";
print "\n\n";

open(LOGFILE, ">>/afs/unc/home/jbs/public_html/counts/logfile");
$host = $ENV{REMOTE_ADDR};
$date = `date`;
print LOGFILE pack("A30A16A30A2", $file, $host, $date, "\n");
#print pack("A30A20A30", $file, $host, $date);

close(LOGFILE);
open(LOGFILE, "</afs/unc/home/jbs/public_html/counts/logfile");

while (<LOGFILE>) {
chop;
($file, $host, $date) = unpack("A30A16A30", $_);
%parts = split(/./,$host);
$net_host = pack('C4', %net_parts);

%net_info = gethostbyaddr($net_host,'1');
$host = $net_info[0];
print "<BR>%net_info $file $host $date";
}
