#!/usr/bin/perl5 ################################## #banner.pl # # Handles the display of banner ads on the djfpc site as # well as access logging on that site. # # Accepts environmental output in the form of arguments # e.g., # # # ¥ 'section=[rsr/ia/am/eu/etc.]' # Signifies the section that the ad is displayed in # # ¥ 'display=[y/n]' # Allows you to display an ad (y) or log without display (n) ################################## $rootPath = '/webhome/d/dowjones/djfpc.com/www/property'; $logFile = "$rootPath/iglog.txt"; $time = localtime; $user = $ENV{'REMOTE_USER'}; $browser = $ENV{'HTTP_USER_AGENT'}; $path = $ENV{'DOCUMENT_URI'}; $referer = $ENV{'DOCUMENT_NAME'}; ($host = $ENV{'REMOTE_HOST'}) || ($host = $ENV{'REMOTE_ADDR'}); $string = $ENV{'QUERY_STRING'}; ($x, $issue) = split(/\=/,$string); #print "Content-type: text/plain\n\n"; @logVars = ( 'Time and Date', 'Username', 'Host', 'Section', 'Referer', 'Browser', 'Image', ); if (! -e $logFile) { $fields = join("\t", @logVars); open(OUT, ">$logFile"); flock(OUT, 2); print OUT "$fields\n"; flock(OUT, 8); close(OUT); } #################################################################### #################################################################### open(OUT, ">>$logFile"); flock(OUT, 2); print OUT "$time\t$user\t$host\t$browser\n"; flock(OUT, 8); close(OUT); $returnpage = "../property/$issue/investorsguide.pdf"; print "Location: $returnpage\n\n";