|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
#14 |
Mean people suck, nice people swallow, are you mean or nice?
|
I use this script and put it in a folder called "rotator". In that folder I have my ads on html pages and another folder called "ads" with copies of the same html pages. Upload everything and on the page where I want the ads to rotate I have: <!--#include virtual="/rotator/random-advert.php" -->
<?php I don't know anything about all this and how it works, but it does. Hit refresh and the ads rotate ![]() ################################################################### # # # Easy Ad Rotation # # # # Written by Tom Armstrong # # # # Support Available at http://www.tomsnewbiebooster.com/ # # # # This script may not be modified or re-sold # # # ################################################################### // TEST MODE - SET TO on OR off $test_mode = "off"; ################################################################### # # # Don't edit anything below here :-) # # # ################################################################### // RESET ADS $ads = ""; // AND PICK AN AD // COUNT ADS $dirhandle = opendir("ads/"); while($filename = readdir($dirhandle)) { if (ereg ("htm", $filename)) { $ads[]=$filename; } } closedir($dirhandle); $number_of_ads = count($ads); if($test_mode == "on") { print("There are <B>$number_of_ads</B> ads in the ads folder<BR>"); } // SET THE RANDOM SEED mt_srand(doubleval(microtime()) * 100000000); // PICK A RANDOM NUMBER $random_number = mt_rand(1, $number_of_ads); if($test_mode == "on") { print("I am going to show advert <B>$random_number</B> of <B>$number_of_ads</B><BR><BR>"); } $array_number = $random_number -1; include("ads/$ads[$array_number]"); ?> |
![]() |
![]() |
|
|