If you have many ads or affiliate banners and you want to rotate them on your website, here is the way on how to do it. But make sure your server supports PHP because we are using PHP script here.
First, you need to create a blank PHP file and name it as rotateads.php. Then copy this code and paste it in.
<?php
$bannerCounter = 1;
$bannerCode[$bannerCounter] = ‘replace with your ad code‘;
$bannerCounter++;
$bannerCode[$bannerCounter] = ‘replace with your ad code‘;
$bannerCounter++;
$bannerAdTotals = $bannerCounter – 1;
if($bannerAdTotals>1)
{
mt_srand((double)microtime() * 1234567);
$bannerPicked = mt_rand(1, $bannerAdTotals);
}
else
{
$bannerPicked = 1;
}
$bannerAd = $bannerCode[$bannerPicked];
echo $bannerAd;
?>
As you can see at the above code, you need to replace “replace with your ad code ” with your own ad or banner code. If you want to put more ad in the rotation, just add these two more lines
$bannerCode[$bannerCounter] = ‘replace with your ad code‘;
$bannerCounter++;
below the previous one.



