# Perl/Mysql Based Random Ad Banner Rotator
# Version 3.0
# README File
# By Mike Calabrese
# http://www.mikecalabrese.com/index.shtml
# 01-17-2005

# This program is available for free on an AS-IS basis.  I am not
# responsible for consequential damages, loss of income or whatever
# else that may happen as a result of the use of this program.

This program is designed to rotate randomly selected ad banners on a web
page utilizing SSI or Server Side Includes, Perl, PerlDBI and a Mysql
database.

Server Side Includes are commands imbedded within web pages that execute
remote programs.  Your web server must be configured properly in order to
run Server Side Include programs.  If you are not sure whether your web server
has SSI capability, please contact your system administrator.

PLEASE NOTE- You must have MySQL 3.23 or newer and PerlDBI
installed and running on your web server in order for these files to work.
Again, if you are not sure if you have these programs installed on your web
server, please contact your system administrator.

The way the application works is that a database call is made that
returns the maximum number of ad banners that are in your database.
That number is then used as the max value when a random number between 1
and that number is called.  The random number generated is used in a database
call that brings back the image url, the link url and the alt tag of a given
ad banner.  That resulting ad banner is then displayed to the user.

The following configuration changes need to be made in order to successfully
run this program:

1) Within your Mysql database create a table called adban468 with the
following attributes:

+------------------+--------------+------+-----+---------+-------+
| Field            | Type         | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+-------+
| reference_number | mediumint(9) |      |     | 0       |       |
| ad_banner        | blob         |      |     |         |       |
| vendor_name      | varchar(50)  | YES  |     | NULL    |       |
+------------------+--------------+------+-----+---------+-------+

Insert your ad banner information to this table.  Make sure that the
reference numbers are sequential as this is the basis of how this app
works.  If you have to remove a banner from the database for some reason,
you have to replace it with another banner to keep the reference numbers
sequential.

2) On your web server create a directory called adban468 where your cgi-bin
files reside.  Chmod this file to 755.  On some servers you may have to chown
this directory to the proper group name.  Copy the file adban468.pl to this
directory. Chmod this file to 755.  On some servers you may have to chown
this file to the proper group name. There are a number of variables that you
have to configure in this file:

a) Line 1- Make sure that the path to Perl is correct.  Typing "which perl"
at the command line should answer this.
b) Lines 20 & 51- Replace "databasename" with the name of your MySQL
database.  If your MySQL database is not on the same machine that your
web server is, you have to change "localhost" to the path to this machine.
c) Lines 23 & 54- Replace "username" with your MySQL login name.
d) Lines 26 & 57 - Replace "userpwd" with your MySQL password.
e) Save the file and exit.

3) Where your HTML documents reside, insert the following command on the web
page that you want the ad banner to occur.  Again, this page has to to have 
the extension .shtml:

<!--#exec cgi="/cgi-bin/adban468/adban468.pl"-->

Make sure that the exact HTML path to adban468.pl is shown in the above com-
mand.  You can test the program by manually running the adban468.pl
script from your /cgi-bin/adban468 directory and then looking at the re-
sulting output from the SSI call.

If your database is set up properly, your ad banners are
inserted correctly, your Perl script and your SSI call is installed and
configured properly, then you should see a new ad banner each time that your
selected .shtml ad banner page is refreshed.

Changes for version 3.0 included eliminating the file called reference_number.txt
that stored the maximum number of ads in the database.  That is now called by a
database call instead.