Here's the code I used to create the directories:
Code: Select all
$idsql = "SELECT id FROM digitalpics WHERE camsetname = '$dcamsetname'";
$idquery = mysql_query($idsql);
$idarray = mysql_fetch_array($idquery);
mkdir("digital/".$idarrayї'id']."", 0777);
mkdir("digital/".$idarrayї'id']."/thumbs", 0777);Here's the code I have to delete both directories:
Code: Select all
function deldir2($dir) {
$dh=opendir("/home/scottttt/public_html/lexylust/digital/$dcamsettodelete/thumbs/");
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) { unlink($fullpath); } else { deldir($fullpath); } } }
closedir($dh);
if(rmdir($dir)) { return true; } else { return false; }
deldir2("/home/scottttt/public_html/lexylust/digital/$dcamsettodelete/thumbs/");
function deldir($dir) {
$dh=opendir("/home/scottttt/public_html/lexylust/digital/$dcamsettodelete");
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) { unlink($fullpath); } else { deldir($fullpath); } } }
closedir($dh);
if(rmdir($dir)) { return true; } else { return false; } }
deldir("/home/scottttt/public_html/lexylust/digital/$dcamsettodelete");What's wrong?