#!/usr/bin/perl # robots.txt - access recording script use strict; use Socket; my $remoteaddr = $ENV{'REMOTE_ADDR'}; my $remotehost = $ENV{'REMOTE_HOST'}; my $useragent = $ENV{'HTTP_USER_AGENT'}; my $from = $ENV{'HTTP_FROM'}; if ($remotehost eq $remoteaddr) {$remotehost = '';} if (!$remotehost) { if ($remoteaddr =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/) { $remotehost = gethostbyaddr(pack('C4',$1,$2,$3,$4), AF_INET); } } my $botlog = '/home/textual/data/73/rbtlog.txt'; my $lock = '/home/textual/data/73/lock'; my $locked; my $logrec; if (open(LOCK,">>$lock") && flock(LOCK,2)) {$locked = 1;} my $timenow = time; if ($locked && open(LOG,">>$botlog")) { $logrec = join("\x00", $timenow,$remoteaddr,$remotehost,$useragent,$from); print LOG "$logrec\n"; close(LOG); } print "Content-type: text/plain\n\n"; print <<'*EOT*'; User-agent: * Disallow: /chlamys *EOT* #=========== end of script ===========