<?PHP 
$savefile1="./../".$SYSD."/check-webdata-dir.inc.txt";
if (file_exists($savefile1)){unlink($savefile1);}
$savefile2="./../".$SYSD."/check-webdata-files.inc.txt";
if (file_exists($savefile2)){unlink($savefile2);}
$savefile3="./../".$SYSD."/check-webdata-all.inc.txt";
if (file_exists($savefile3)){unlink($savefile3);}
$savefile4="./../".$SYSD."/check-webdata-dirR.inc.txt";
if (file_exists($savefile4)){unlink($savefile4);}
$savefile5="./../".$SYSD."/check-webdata-dirL.inc.txt";
if (file_exists($savefile5)){unlink($savefile5);}
$savefile6="./../".$SYSD."/check-webdata-dir7.inc.txt";
if (file_exists($savefile6)){unlink($savefile6);}
$savefile7="./../".$SYSD."/check-webdata-filesR.inc.txt";
if (file_exists($savefile7)){unlink($savefile7);}
$savefile8="./../".$SYSD."/check-webdata-filesL.inc.txt";
if (file_exists($savefile8)){unlink($savefile8);}
$savefile9="./../".$SYSD."/check-webdata-files7.inc.txt";
if (file_exists($savefile9)){unlink($savefile9);}
$savefile10="./../".$SYSD."/check-webdata-image.inc.txt";
if (file_exists($savefile10)){unlink($savefile10);}
$savefile11="./../".$SYSD."/check-webdata-media.inc.txt";
if (file_exists($savefile11)){unlink($savefile11);}
$savefile12="./../".$SYSD."/check-webdata-flash.inc.txt";
if (file_exists($savefile12)){unlink($savefile12);}
$savefile13="./../tmp/check-webdata-websites.inc.txt";
if (file_exists($savefile13)){unlink($savefile13);}
$savefile14="./../".$SYSD."/check-webdata-websites.inc.txt";
if (file_exists($savefile14)){unlink($savefile14);}
$savefile15="./../".$SYSD."/check-webdata-filesResult.inc.txt";
if (file_exists($savefile15)){unlink($savefile15);}

read_rekursiv();

function read_rekursiv($path="./../../.."){
include("./../configure/configadmin-a.inc.php");
include("./../configure/configadmin-b.inc.php");
$dir=dir($path);
while(false !== ($file = $dir->read())){
//if(("."  == $file) OR (".." == $file) OR ("sysadmin" == $file) OR ("$wssiteL" == $file))
if(("."  == $file) OR (".." == $file))
continue;

if(is_dir($path."/".$file)){
list ($chmod1,$chmod2)  = filerights($path."/".$file,true);
clearstatcache();

$DATA1D="$path/$file|$chmod2\n";
$DATA1D=str_replace("../../../","",$DATA1D);
$handle=fopen("./../".$SYSD."/check-webdata-dir.inc.txt", "a");
fwrite($handle,$DATA1D);
fclose($handle);

$DATA1A="$path/$file/*|$chmod2\n";
$DATA1A=str_replace("../../../","",$DATA1A);
$handle=fopen("./../".$SYSD."/check-webdata-all.inc.txt", "a");
fwrite($handle,$DATA1A);
fclose($handle);

$DATA1R="$chmod2\n";
$DATA1R=str_replace("../../../","",$DATA1R);
$handle=fopen("./../".$SYSD."/check-webdata-dirR.inc.txt", "a");
fwrite($handle,$DATA1R);
fclose($handle);

$DATA1L="$path/$file\n";
$DATA1L=str_replace("../../../","",$DATA1L);
$handle=fopen("./../".$SYSD."/check-webdata-dirL.inc.txt", "a");
fwrite($handle,$DATA1L);
fclose($handle);

if($chmod2 == "0777"){
$DATA1R7="$path/$file|$chmod2\n";
$DATA1R7=str_replace("../../../","",$DATA1R7);
$handle=fopen("./../".$SYSD."/check-webdata-dir7.inc.txt", "a");
fwrite($handle,$DATA1R7);
fclose($handle);
}else{
$DATA1R7="";
$handle=fopen("./../".$SYSD."/check-webdata-dir7.inc.txt", "a");
fwrite($handle,$DATA1R7);
fclose($handle);
}


read_rekursiv($path."/".$file);
}else{
list ($chmod1,$chmod2) = filerights($path."/".$file, false);
clearstatcache();

$DATA2F="$path/$file|$chmod2\n";
$DATA2F=str_replace("../../../","",$DATA2F);
$handle=fopen("./../".$SYSD."/check-webdata-files.inc.txt", "a");
fwrite($handle,$DATA2F);
fclose($handle);

$DATA2A="$path/$file|$chmod2\n";
$DATA2A=str_replace("../../../","",$DATA2A);
$handle=fopen("./../".$SYSD."/check-webdata-all.inc.txt", "a");
fwrite($handle,$DATA2A);
fclose($handle);

$DATA2R="$chmod2\n";
$DATA2R=str_replace("../../../","",$DATA2R);
$handle=fopen("./../".$SYSD."/check-webdata-filesR.inc.txt", "a");
fwrite($handle,$DATA2R);
fclose($handle);

$DATA2L="$path/$file\n";
$DATA2L=str_replace("../../../","",$DATA2L);
$handle=fopen("./../".$SYSD."/check-webdata-filesL.inc.txt", "a");
fwrite($handle,$DATA2L);
fclose($handle);

$fileWeb=substr(strrchr($file,"."),0);
$fileWebX=strtolower($fileWeb);
if(($fileWebX == ".html") OR ($fileWebX == ".htm") OR ($fileWebX == ".php")){
$DATA2W="$path/$file|$chmod2\n";
$DATA2W=str_replace("../../../","",$DATA2W);
$handle=fopen("./../tmp/check-webdata-websites.inc.txt", "a");
fwrite($handle,$DATA2W);
fclose($handle);
}

$fileImage=substr(strrchr($file,"."),0);
$fileImageX=strtolower($fileImage);
if(($fileImageX == ".gif") OR ($fileImageX == ".jpg") OR ($fileImageX == ".png") OR ($fileImageX == ".bmp") OR ($fileImageX == ".ico") OR ($fileImageX == ".jpeg")){
$DATA2I="$path/$file\n";
$DATA2I=str_replace("../../../","",$DATA2I);
$DATA2I=str_replace("./","",$DATA2I);
$DATA2I=$wwwX.$wssiteW."/".$DATA2I;
$handle=fopen("./../".$SYSD."/check-webdata-image.inc.txt", "a");
fwrite($handle,$DATA2I);
fclose($handle);
}

$fileMedia=substr(strrchr($file,"."),0);
$fileMediaX=strtolower($fileMedia);
if(($fileMediaX == ".mov") OR ($fileMediaX == ".avi") OR ($fileMediaX == ".mp4") OR ($fileMediaX == ".flv")){
$DATA2M="$path/$file\n";
$DATA2M=str_replace("../../../","",$DATA2M);
$DATA2M=str_replace("./","",$DATA2M);
$DATA2M=$wwwX.$wssiteW."/".$DATA2M;
$handle=fopen("./../".$SYSD."/check-webdata-media.inc.txt", "a");
fwrite($handle,$DATA2M);
fclose($handle);
}

$fileFlash=substr(strrchr($file,"."),0);
$fileFlashX=strtolower($fileFlash);
if($fileFlashX == ".swf"){
$DATA2F="$path/$file\n";
$DATA2F=str_replace("../../../","",$DATA2F);
$DATA2F=str_replace("./","",$DATA2F);
$DATA2F=$wwwX.$wssiteW."/".$DATA2F;
$handle=fopen("./../".$SYSD."/check-webdata-flash.inc.txt", "a");
fwrite($handle,$DATA2F);
fclose($handle);
}

if($chmod2 == "0777"){
$DATA2R7="$path/$file|$chmod2\n";
$DATA2R7=str_replace("../../../","",$DATA2R7);
$handle=fopen("./../".$SYSD."/check-webdata-files7.inc.txt", "a");
fwrite($handle,$DATA2R7);
fclose($handle);
}else{
$DATA2R7="";
$handle=fopen("./../".$SYSD."/check-webdata-files7.inc.txt", "a");
fwrite($handle,$DATA2R7);
fclose($handle);
}

}         
}         
$dir->close();     
} 

function filerights($file,$octal=false){
if(!file_exists($file)) return false;
$perms=fileperms($file);
$cut=$octal ? 1 : 2;
$chmod=substr(decoct($perms), $cut);
return array($perms, $chmod);
} 
?>