http://www.byte.com/art/download/loglink.pl (PC Press Internet CD, 03/1996)
# LOGLINK - Tracks www use at link, rather than page, level.
#
# Called from a link of the form:
# Link text
#
# Jon Udell, BYTE, jon_u@dev5.byte.com,judelL@bix.com
$name = $ARGV[0]; # name of the link being tracked
$url = $ARGV[1]; # url for the link being tracked
$dir = $ARGV[2]; # dir for file containing tracking history for this link
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$date = sprintf("%02d-%02d-%02d",$year,$mon,$mday);
$time = sprintf("%02d:%02d",$hour,$min);
if (! (-f "$dir/$name")) # if it is new
{
open (LOG, ">$dir/$name"); # create the tracking file
close LOG;
}
open (LOG, ">>$dir/$name"); # store what we need
print LOG $date, " ~ ", $wday, " ~ ", $time, " ~ ",$ENV{'REMOTE_ADDR'}, " ~ ",$ENV{'USER_AGENT'},"\n";
close LOG;
print "Location: $url\n\n"; # redirect the browser to the original URL