![]() |
php Ad Rotator
I've been using this ad rotator script for 6 months and it worked fine. Now I notice the ads don't appear at all. Any ideas why it would just quit all of a sudden? |huh
// TEST MODE - SET TO on OR off $test_mode = "off"; // 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 $number_of_ads ads in the ads folder "); } // 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 $random_number of $number_of_ads "); } $array_number = $random_number -1; include("ads/$ads[$array_number]"); ?> |
server setting seems most likely if you didn't change anything - sure php is allowed? Or even if html is executed as php if you sites are .htm(l)?
I'm no programmer, so best advice is to ask your host to check the logs. |
With test mode on what's the output?
|
Quote:
Quote:
|
if($test_mode == "on") {
print("There are $number_of_ads ads in the ads folder "); } I'm wondering what that outputs. Offhand either it can't find the ads, or it can't display them. If that test output comes back with $number_of_ads greater than 0 then the problem is narrowed down. |
I think the tech at my host is getting things fixed. Don't know what he's doing but "rotator1" is working on the index page but "rotator2" isn't working on the main page. He's on top of it.|thumb
|
All times are GMT -4. The time now is 12:52 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc