JDTMMSM.COM Welcome to jdtmmsm.com
Make a Donation | Downloads | Contact Us | Forums | Login | Help
 
HOME
PLEASE DONATE
PROJECTS
TUTORIALS
CODE LIBRARY
FORUM
DOWNLOADS
LINKS
RESUME
CONTACT ME
LOGIN
REGISTER
Projects
 
EZsneezyCal
ezRecipe-Zee
A Little Q&A
 
Tutorials
 
Simple Banner Rotator
Basic Authentication
 
Code Library
 
Create Select From Set Field
getDirNamesAsArray()
getFileSizeFormatted()
Simple Banner Rotator
Basic Authentication
 

Simple Banner Rotator
Date Listed: March 10, 2008
Submitted By: Dave Torres
Pages   1 , 2 , 3 , 4 , 5

To display banner ads on your website you can just sign up with Google’s AdSense program or one of the many other advertising programs out there. But if you want to show your own banners or those of your website members and sponsors you should have your own banner script.

For now we will take care of the displaying of the banners. Tracking the number of clicks will be handled in a different tutorial. So lets have a look at what we want this script to do exactly.

If I have several banners to display I would want them all to be displayed an equal number of times. We can force this by tracking how many times each banner has been displayed and select the banner with the least number of views to show. Another way is to just select one of the banners randomly. Statistics and probability tell us that randomly selecting one of the banners each time, will over time give each banner a fairly equal amount of views. For this script we will use the random function to select which banner to display.

To track how many times each banner has been displayed we need to add a counter to each banner. The counter will have to be updated each time we display the banner.

In addition to the banner picture, the alt tag and title tag should be filled. Lets store all the banner information (target URL, picture URL, alt and title tag, banner views) in a MySQL database.

Let’s list the steps of our banner script:

  1. Count how many banners we have stored in our database table
  2. Create a random number between 1 and the number of banners found in step 1
  3. Retrieve the record number equal to the random number that we generated
  4. Update ‘times viewed’ counter on that record
  5. With the retrieved record data, create a link with an image and required tags.

  Simple Banner Rotator Next Page

 
Home   +    Please Donate   +    Projects   +    Tutorials   +    Code Library   +    Forum   +    Downloads   +    Contact Us
© Copyright 2007-2008 Dave Torres. All rights reserved.