Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   php Ad Rotator (http://www.greenguysboard.com/board/showthread.php?t=44076)

Licker4U 2007-11-26 09:47 AM

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]");

?>

N J 2007-11-26 11:47 AM

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.

shunga 2007-11-26 11:58 AM

With test mode on what's the output?

Licker4U 2007-11-26 12:34 PM

Quote:

Originally Posted by N J (Post 375945)
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.

I was thinking it was a server issue and sent a trouble ticket to my host. Just can't believe they would change something to make the script stop after six months.

Quote:

Originally Posted by shunga (Post 375946)
With test mode on what's the output?

Nothing. I think that is a test so potential users can see how it works

shunga 2007-11-26 01:43 PM

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.

Licker4U 2007-11-26 02:22 PM

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