simple script suddenly stops working

Hi

Does anyone have any idea why the following script

<?php # Most recently updated file in a directory # Set up $dir = "."; $pattern = '\.(jpg)$'; $newstamp = 0; $newname = ""; $dc = opendir($dir); while ($fn = readdir($dc)) { # Eliminate current directory, parent directory if (ereg('^\.{1,2}$',$fn)) continue; # Eliminate other pages not in pattern if (! ereg($pattern,$fn)) continue; $timedat = filemtime("$dir/$fn"); if ($timedat > $newstamp) { $newstamp = $timedat; $newname = $fn; } else { unlink($fn); } } # $newstamp is the time for the latest file # $newname is the name of the latest file rename($newname,'snapshot.jpg'); closedir($dc); ?>

On the page www.goodlifehomebrew.com

Should suddenly stop working

Many thanks

Paul

you have renamed all irregs

rename($newname,'snapshot.jpg');
?
Sponsor our Newsletter | Privacy Policy | Terms of Service