Field Name: | Field Content
####
## ##
## ##
## ##
");
document.write("Hello "+username+", welcome to my homenode. Your visit has been logged. If you'd like to see my log you can see it here.")
}
//-->
## ##
#!/usr/bin/perl -w
$visitorfile = "/path/to/visitors.txt";
use CGI;
$query = new CGI;
# If the visitor parameter exists then we assume its a visit from the home node:
if (my $visitor = $query->param('visitor')) {
# Don't log ourselves:
unless ($visitor =~ /your_username/i ) {
open (VISITORS,">>$visitorfile") || die("Perlmonk Visitors couldn't open $visitorfile: $!");
print VISITORS scalar(localtime) . "\t" . $visitor . "\t" . $ENV{HTTP_REFERER} . "\n";
close VISITORS;
}
print "Content-Type: text/javascript\n\n";
# Output our javascript:
print qq|document.write("Welcome and ")|;
} else {
open (VISITORS,"$visitorfile") || die("Perlmonk Visitors couldn't open $visitorfile: $!");
@data = ;
close VISITORS;
print "Content-Type: text/html\n\n";
print "Visitors to my Homenode\n";
print "Time/Date | Username | \n";
foreach $line(@data) {
my ($date, $user) = split(/\t/,$line);
print "$date | $user | \n";
}
print " ";
}
## ##
## ##
|