|
2007-11-26, 09:47 AM | #1 |
Mean people suck, nice people swallow, are you mean or nice?
|
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?
<?php // 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 <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]"); ?> |
2007-11-26, 11:47 AM | #2 |
Trying is the first step towards failure
Join Date: Oct 2004
Posts: 128
|
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. |
2007-11-26, 11:58 AM | #3 |
Operator! Give me the number for 911!
|
With test mode on what's the output?
|
2007-11-26, 12:34 PM | #4 | |
Mean people suck, nice people swallow, are you mean or nice?
|
Quote:
Nothing. I think that is a test so potential users can see how it works |
|
2007-11-26, 01:43 PM | #5 |
Operator! Give me the number for 911!
|
if($test_mode == "on") {
print("There are <B>$number_of_ads</B> ads in the ads folder<BR>"); } 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. |
2007-11-26, 02:22 PM | #6 |
Mean people suck, nice people swallow, are you mean or nice?
|
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.
|
|
|