I'm using the code down below to delete old files, but it keeps saying: syntax error, unexpected '}'
, but I can't spot where, please help me to fix it..
function destroy($dir) {
$mydir = opendir($dir);
while($file = readdir($dir)) {
if($file != "." && $file != "..") {
chmod($dir.$file, 0777);
if(is_dir($dir.$file)) {
chdir('.');
while($dir.$file) {
if(date("U",filectime($file) >= time() - 3600)
{
unlink($dir.$file)
}
}
}
else
unlink($dir.$file) or DIE("couldn't delete $dir$file<br />");
}
}
closedir($dir);
}