#!/usr/local/bin/perl
############################################################
# Banner_Ad_Section_Top.Cgi
#
# This script was written by Martin Hubert
# Date Created: 2-05-97
# Date Changed: 5-03-99
#
# 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'};
# Sanity Check
if ($id eq "") { $id = 'default' };
if ($list eq "") { $list = 'default' };
$http = $ENV{HTTP_REFERER} ;
$http =~ /http:\/\/.*\/(.*)\/.*/;
$category = $in{'category'};
($ad_title,$ad_gif,$ad_link)=&GetAdInfo($list);
&SaveRef($id);
# Begin to send back the dynamic search results page with the header.
print <Freightgate - Banner
end_html
if ($ad_link eq "flycast") {
print <
end_html
} else {
print <
end_html
}
print <
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();
# banner for the Transportation Info Section
if ($category eq "transportation_info") {
$ii = int(rand(3)) ;
@ad_title = ('Vanco','UTC Overseas','flycast');
@ad_link = ("http://www.vanco.net","Http://www.utcoverseas.com/","flycast");
@ad_gif = ("vanco_banner.gif","utc_banner.gif","flycast");
#@ad_title = ('Vanco','UTC Overseas','flycast');
#@ad_link = ("http://www.vanco.net","Http://www.utcoverseas.com/","flycast");
#@ad_gif = ("vanco_banner.gif","utc_banner.gif","flycast");
# banner for the Freight Directories Section
} elsif ($category eq "directories") {
$ii = int(rand(3)) ;
@ad_title = ('Vanco','Primary Freight Services','flycast');
@ad_link = ("http://www.vanco.net","http://www.pfrt.com","flycast");
@ad_gif = ("vanco_banner.gif","pfrt_banner.gif","flycast");
# banner for the Track and Trace Section
} elsif ($category eq "track_trace") {
$ii = int(rand(2)) ;
@ad_title = ('UTC Overseas','flycast');
@ad_link = ("http://www.utcoverseas.com/","flycast");
@ad_gif = ("utc_banner.gif","flycast");
# banner for the Reference Guide Section
} elsif ($category eq "reference") {
$ii = int(rand(3)) ;
@ad_title = ('I-Trek!','Vanco','flycast');
@ad_link = ("http://www.freightgate.com/offer/itrek.shtml","http://www.vanco.net","flycast");
@ad_gif = ("itrek_banner.gif","vanco_banner.gif","flycast");
# banner for the Sailing Schedule Section
} elsif ($category eq "schedule") {
$ii = int(rand(3)) ;
@ad_title = ('Vanco','Columbus Line','flycast');
@ad_link = ("http://www.vanco.net","http://www.columbusline.com","flycast");
@ad_gif = ("vanco_banner.gif","columbus_banner.gif","flycast");
# banner for the Airlines Schedule Section
} elsif ($category eq "airline") {
$ii = int(rand(2)) ;
@ad_title = ('Freightgate Marketplace','I-Trek!');
@ad_link = ("http://www.freightgate.com/marketplace.shtml","http://www.freightgate.com/offer/itrek.shtml");
@ad_gif = ("freightgate_banner_web.gif","itrek_banner.gif");
# banner for all the rest
} else {
$ii = int(rand(4)) ;
@ad_title = ('flycast','Freightgate Marketplace','I-Trek!','Vanco');
@ad_link = ("flycast","http://www.freightgate.com/marketplace.shtml","http://www.freightgate.com/offer/itrek.shtml","http://www.vanco.net");
@ad_gif = ("flycast","freightgate_banner_web.gif","itrek_banner.gif","vanco_banner.gif","tri_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