Chmod PHP problem
Hej Eksperter.Er nu ved at være godt kørt fast i den samme smøre. Jeg vil gerne oprette en mappe, og chmodde den til 777. Problemet er, at mappen altid får moddingen 411.
Min kode er som følger:
$query=mysql_query("SELECT * FROM System_pages WHERE gallery IS NOT NULL");
if(@mkdir("./../gallery/content/".$_POST["get_write_name"]."/",777)){
if(@chmod("./../gallery/content/".$_POST["get_write_name"]."/",777)!==TRUE){
get_board("Response","An error occured while chmodding.");
exit;
}
while($p=mysql_fetch_assoc($query)){
if($galdir=@mkdir("./../gallery/content/".$p["name"]."/Galleries/",777)){
if($galdir=@mkdir("./../gallery/content/".$p["name"]."/Galleries/".$_POST["get_write_name"]."/",777)){
if(!$folderdata=@fopen($galdir."folderdata.xml","w")){
get_board("Response","An error occured while creating the folderdata.xml.");
exit;
}
if(fwrite($folderdata,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<folder fileCount=\"0\" title=\"".$_POST["get_write_name"]."\" previewimage=\"\" description=\"Click here to jump to the gallery "".$_POST["get_write_name"]."\" pageContent=\"http://sjfoto.dk/galleri/?contentfolder=/content/".$_POST["get_write_name"]."/\" sort=\"auto\" hidden=\"\" page=\"link\" fileMod=\"\" parameters=\"\"/>")===FALSE){
get_board("Response","An error occured while writing the folderdata.xml.");
exit;
}
fclose($folderdata);
}else{
get_board("Response","An error occured while creating the ../gallery/content/".$p["name"]."/Galleries/".$_POST["get_write_name"]."/ dir.");
exit;
}
}else{
get_board("Response","An error occured while creating the ../gallery/content/".$p["name"]."/Galleries/ dir.");
exit;
}
}
get_board("Response","The gallery was succesfully written.");
}
Underligt nok så opretter scriptet den første mappe, men ligeså snart den skal oprette "Galleries"-mappen, så kan den ikke, da den første mappe som sagt for en chmod med 411.
Funktionen get_board($heading,$text), smider en besked tilbage til brugeren...
Håber i kan hjælpe mig.
Mvh. Frederik