When a user logs into my site...a temporary directory is created on MY server, in the 'c:\windows\temp\' directory
the dir is created with 0770 mode.
when the user logs out i want to empty the folder and remove the directory
this is my attempt:
create temp dir (works fine and all other references to this are ie i can create files in this dir)
if(!is_dir($_SESSION['usrdir'] = "c:/windows/temp/".$_SESSION["username"]."_temporary/")){
mkdir($_SESSION['usrdir'],0770);
}
remove the temp dir and any files inside
if(is_dir($_SESSION['usrdir'] = "c:/windows/temp/".$_SESSION["username"]."_temporary/")){
//get temp file list
$count=0;
if ($Handle = opendir($_SESSION['usrdir'])) {
while (false !== ($file = readdir($Handle))) {
if(($file != '.') AND ($file != '..')){
$List[$count] = $_SESSION['usrdir'].$file;
$count +=1;
}
}
closedir($Handle);
}
//unlink(remove) files in list
for($x=0;$x<$count;$x++){
unlink($List[$x]);
}
//remove user temp directory
rmdir($_SESSION['usrdir']);
}
I am using IIS 5.x on an xp box using PHP 5.0.4
Does anyone have an idea where it is wrong?