Simple PHP Banner script

Filed under News

Ok so I had sold some banners [look up!] and needed a way to roate them in a random form. Well my solution is quite simple and if you are needing something to do the same thing below is the script for you! :)

<?php
$bannerAd[1] = 'code for ad 1';
$bannerAd[2] = 'code for ad 2';
$bannerAd[3] = 'code for ad 3';
$bannerAd[4] = 'code for ad 4';
$bannerAd[5] = 'code for ad 5';

$adCount = count($bannerAd);
$randomAdNumber = mt_rand(1, $adCount);
echo $bannerAd[$randomAdNumber];
?>

Now for its use. Place the EXACT code be it flash or image or text inside one of the ” tags. If you dont need all 5 then remove the lines you dont need. If you do need more than 5 then just add more with the next number [6 7 8 9...so on and so forth]

Thats as simple as it gets. Just place that code on your PHP ENABLED site and it will be all good :)

  • DONT FORGET THIS REQUIRES PHP!!!!!!!

-Tracker

One Comment

  1. JavaKrypt says:

    Should add a AJAX rotator :)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*