#!/usr/local/bin/perl ############################################################ # Banner_Ad_bottom.Cgi # # This script was written by Martin Hubert # Date Created: 2-05-97 # # You may copy this under the terms of the GNU General Public # License or the Artistic License which is distributed with # copies of Perl v5.x for UNIX # # Purpose: Provides a mechanism to supply the caller with the HTML Code # for a Banner Ad. # # Main Procedures: # # Inputs: # Form Variables: # id = caller id, to keep track of the hits # list = filename of the database that stores the Ads # # Outputs: # HTML Code with the propper info to display the ad and links # ############################################################ #$| = 1; # Set output to flush directly (for troubleshooting) $lib = "/httpd/cgi-bin/Library"; # Default path for loading libraries require "$lib/cgi-lib.pl"; # Define Server specific variables require "$lib/search_define.pl"; # The following outputs the CGI Header print &PrintHeader; # Get the form variables &ReadParse; $id = $in{'id'}; $list = $in{'list'}; $env = ''; foreach $key (keys %ENV) { $env .= "$key:$ENV{$key}\n"; } $http = $ENV{HTTP_REFERER} ; $category = $in{'category'}; # Sanity Check if ($id eq "") { $id = 'default' }; if ($list eq "") { $list = 'default' }; ($ad_title,$ad_gif,$ad_link)=&GetAdInfo($list); &SaveRef($id); # Begin to send back the dynamic search results page with the header. print < Freighgate - General Bottom Banner

$ad_title

end_html exit; ############################################################ # # subroutine: GetAdInfo # Usage: # ($ad_title,$ad_gif,$ad_link) = &GetAdInfo($list); # # Parameters: # $list= fully qualified path of the ad_info database # # Output: # # ($ad_title,$ad_gif,$ad_link) # # ############################################################ sub GetAdInfo { local($list) = @_; local($ad_title,$ad_gif,$ad_link); my $ii; srand(); if ($category eq "transportation_info") { $ii = int(rand(2)) ; @ad_title = ('I-Trek!','Freightgate'); @ad_link = ("http://www.freightgate.com/offer/itrek.shtml","http://www.freightgate.com/offer/software.shtml"); @ad_gif = ("itreksmall_banner.gif","soft_banner.gif"); return (@ad_title[$ii],@ad_gif[$ii],@ad_link[$ii]); } elsif ($category eq "directories") { $ii = int(rand(2)) ; @ad_title = ('I-Trek!','Freightgate'); @ad_link = ("http://www.freightgate.com/offer/itrek.shtml","http://www.freightgate.com/offer/software.shtml"); @ad_gif = ("itreksmall_banner.gif","soft_banner.gif"); return (@ad_title[$ii],@ad_gif[$ii],@ad_link[$ii]); } else { $ii = int(rand(3)) ; @ad_title = ('Join Cargo-L - a free mailing list - full of news','I-Trek!','Freightgate'); @ad_link = ("http://www.damcomar.com/cargo2.htm","http://www.freightgate.com/offer/itrek.shtml","http://www.freightgate.com/offer/software.shtml"); @ad_gif = ("cargol_banner.gif","itreksmall_banner.gif","soft_banner.gif"); return (@ad_title[$ii],@ad_gif[$ii],@ad_link[$ii]); } } # End of GetAdInfo ############################################################ # # subroutine: SaveRef # Usage: # &SaveRef($id); # # Parameters: # $id = ID of the caller for tracking purposes # # Output: # adds an entry to the tracking database # ############################################################ sub SaveRef { } # End of GetNextEntry