# PHP/Mysql Based Random Ad Banner Rotator
# Version 3.0
# README File
# By Mike Calabrese
# http://www.mikecalabrese.com/index.shtml
# 01-27-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 using the PHP scripting language and a Mysql database.

PLEASE NOTE- You must have PHP4.0.6 or newer AND MySQL 3.23 or newer
installed and running on your web server in order for these files to work.

As far as particular questions about Mysql or PHP are concerned I would
recommend 2 good books on these subjects:  MySQL by Paul DuBois and
PHP and MySQL Web Development by Luke Welling and Laura Thomson

The way the application works is that adatabase 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) Next, where your HTML documents reside, create a directory called adban.
Chmod this directory to 755.  On some servers, you may have
to chown this directory to to the proper group name.  Next, place the file
adban.php within this directory.  Note that on some servers you may need to
rename this file phtml, php3 or php4.  Chmod this file to 755.  On some
servers you may need to chown this file to the proper group name.

3) Now that you have your database set up and your files uploaded, it's time
to configure the adban.php file.

Lines 15 & 26, if your Mysql database is on the same machine as your web
server, then change "yourhostname" to "localhost".  If it is on a different
machine, change "yourhostname" to the name of that machine. "yourlogin" should
be your login to your Mysql database, "yourpassword" should be your login
password to your Mysql database.

Lines 17 & 28, replace "yourdatabase" with the name of your Mysql database.

After line 34, place your conventional HTML.  You can copy everything above
this line to different PHP enabled pages so that they too have rotating ad
banners. When you add new banners to your database, you will have to increase
the reference_numbers.txt file by the number of new ad banners.

If your database is set up properly, your ad banners are
inserted correctly and your .php file is installed and configured
properly, then you should see a new ad banner each time that you reload
adban.php.