Hi i got the folowing code to delete files and directories
if(isset($_POST['wissen']))
{
$albid5= $_POST['album_id1'];
$albnam = $_POST['albumbeschrijv'];
$error = "Es ist ein Problem mit der Datenverbindung aufgetreten,<br />probieren Sie es bitte später noch einmal<br />oder nehmen Sie Kontakt mit dem Webmaster auf.";
$connect = mysql_connect("localhost","bla","bla1") or die ($error);
mysql_select_db("bla") or die($error);
$slides="slides";
$thumbs="thumbs";
$delete = mysql_query("DELETE FROM narr_weinachtfeier WHERE id='$albid5'")or die("Delete Error: ".mysql_error());
echo mysql_error();
$delete = mysql_query("DELETE FROM narr_fotos WHERE albumid='$albid5'")or die("Delete Error: ".mysql_error());
echo mysql_error();
$dir1 = "$albnam/$slides/";
$dir2 = "$albnam/$thumbs/";
$dir3 = "$albnam/";
// Open a known directory, and proceed to read its contents
$mydir = opendir($dir1);
while(false !== ($file = readdir($mydir))) {
if($file != "." && $file != "..") {
chmod($dir1.$file, 0777);
if(is_dir($dir1.$file)) {
chdir('.');
destroy($dir1.$file.'/');
rmdir($dir1.$file) or DIE("couldn't delete $dir$file<br />");
}
else
unlink($dir1.$file) or DIE("couldn't delete $dir$file<br/>");
line 1058 rmdir($dir1);
} }
$mydir2 = opendir($dir2);
while(false !== ($file = readdir($mydir2))) {
if($file != "." && $file != "..") {
chmod($dir2.$file, 0777);
if(is_dir($dir2.$file)) {
chdir('.');
destroy($dir2.$file.'/');
rmdir($dir2.$file) or DIE("couldn't delete $dir$file<br />");
}
else
unlink($dir2.$file) or DIE("couldn't delete $dir$file<br />");
line 1072 rmdir ($dir2);
line 1073 rmdir ($dir3);
} } }
but it give me the folowing warnings:
Warning: rmdir(test 1/slides/) [function.rmdir]: Directory not empty in /var/www/php/login/album_Vereinsauftritte_gewahlt.php on line 1058
Warning: rmdir(test 1/thumbs/) [function.rmdir]: Directory not empty in /var/www/php/login/album_Vereinsauftritte_gewahlt.php on line 1072
Warning: rmdir(test 1/) [function.rmdir]: Directory not empty in /var/www/php/login/album_Vereinsauftritte_gewahlt.php on line 1073
when i look into the server i see the files and dir's are deleted.
But how ist it posible that these warnings are comming and what can i do about it ?
thanks in advice John