#!/usr/local/bin/perl # # redirect.pl # version 961111 # copyright 1996 by bo larsson # all rights reserved # # bugs or feedback to bliss@seagull.net # for information on how to use, visit http://www.seagull.net/bliss/ # set the $log_dir directory (change if you want it somewhere else, but # make sure the $log_dir directory is world-writeable (chmod 777) $log_dir = "./redirection_logs"; # who is this host? $who = $ENV{'REMOTE_HOST'}; # grab the log file and destination information $temp = $ENV{'QUERY_STRING'}; # split this information into separate variables ($log_file,$where_to) = split(/&/,$temp); # create a variable containing the current date and time $when = `date +%y%m%d%H%M`; chop $when; if (!(-e "$log_dir/$log_file")) { open(LOG_FILE,">$log_dir/$log_file"); print LOG_FILE "$when - $who\n"; close(LOG_FILE); } else { open(LOG_FILE,">>$log_dir/$log_file"); flock(LOG_FILE,2); print LOG_FILE "$when - $who\n"; flock(LOG_FILE,8); close(LOG_FILE); } print("location:$where_to\n\n");