Script stopped working

For the past 6 months I have used this script to call up certain files based upon the date:

[code]<?php
$today = date(“z”);

$handle=opendir(’/home/springfi/public_html/happenings/’);
while (($file = readdir($handle))!==false) {

if ($file == $today + '.php') {
    include("happenings/$file");
    }

}
closedir($handle);
?>

	</p>

	<p>
<?php $tomorrow = date("z")+1; $handle=opendir('/home/springfi/public_html/happenings/'); while (($file = readdir($handle))!==false) { if ($file == $tomorrow + '.php') { include("happenings/$file"); } } closedir($handle); ?>

[/code]

And the script continues to cover two weeks. The files being called up are named 0.php through 365.php

Today I start getting errors:

Warning: include(happenings/.) [function.include]: failed to open stream: No such file or directory in /home/springfi/public_html/oldhappenings.php on line 9

Warning: include() [function.include]: Failed opening ‘happenings/.’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/springfi/public_html/oldhappenings.php on line 9

It appears to be attempting to display an error message for each file and folder in the /happenings/ directory - over 100 error messages before I stop the browser.

I’m at a loss.

Try running a script from the same directory that just includes one of the files. I’m thinking your files got (re)moved. Please check to make sure your files still exist where you expect them to be.

Yes, the files are there.

Today it works fine - obviously it has something to do with yesterday being day 0 - that’s the only thing I can think of.

Sponsor our Newsletter | Privacy Policy | Terms of Service