include ("../include/mysql.php");
$path = "/home/munds/public_html/scupload/";
$handle=opendir($path);
echo "Garbage Collection:
";
while (false !== ($file = readdir($handle))) {
if ($file!="garbageCollection.php" && !is_dir($file)) {
$z++;
$part=substr($file,0,strpos($file,"_"));
$query="SELECT id FROM siteobs WHERE id='".$part."'";
query($query);
if (mysql_num_rows($res)==0) {
exec("rm ".$path.$part."*");
echo "Alle Dateien für Objekt ".$part." gelöscht!
";
$file=readdir($handle);
}
else {
$query = "SELECT value FROM siteprops WHERE value= '$file'";
query($query);
$ispic = mysql_num_rows($res);
if ($ispic == 0) {
unlink ($picpath.$file);
echo "Bild ".$picpath.$file." gel\xf6scht!
";
}
}
}
}
?>