File Directory Php

if($pageAction=="add")
{
chdir(".".$dirname);
mkdir($directory,0);
Header("Location: index.php3?dirname=$dirname");
}
if($pageAction=="delete")
{
chdir(".".$dirname);
rmdir($directory);
Header("Location: index.php3?dirname=$dirname");
}
?>


Directory Browser


echo "";
if($dirname)
{
$myDirectory=opendir(".".$dirname);
chdir(".".$dirname);
echo "";
echo "";
$dir_count=1;
$dir_count_tot=1;
}
else
{
$myDirectory=opendir(".");
$dir_count=0;
$dir_count_tot=0;
}
while($entryName=readdir($myDirectory))
{
if(!is_file($entryName))
{
if($entryName!=".." && $entryName!=".")
{
if($dir_count==0)
{
echo "";
}
echo "";
$dir_count++;
$dir_count_tot++;
if($dir_count==10)
{
$dir_count=0;
echo "";
}
}
}
else
{
if(strstr($entryName, ".gif") || strstr($entryName, ".gif"))
{
if($entryName!="dir.gif" && $entryName!="dirback.gif")
{
$images[]=$entryName;
}
}
}
}
$i=0;
while($i{
if($dir_count==0)
{
echo "
";
}
echo "";
$dir_count++;
$dir_count_tot++;
if($dir_count==10)
{
$dir_count=0;
echo "";
}
$i++;
}
while($dir_count_tot<10)
{
echo "";
$dir_count_tot++;
}
echo "";
echo "
";
echo "";
echo "";
echo "
";
$list=explode("/", $dirname);
for($i=1;$i {
$olddir=$olddir . "/" . $list[$i];
}
echo "src='http://localhost/DirAcc/dirback.gif'>";
echo "
";
echo "size='1'>Back
";
echo "
";
echo "
";
$toopen=$dirname . "/" . $entryName;
echo "
align=\"center\">";
$dirs[]=$entryName;
echo "border=\"0\" src=\"http://localhost/NewDirAcc/dir.gif\">
";
echo "face=\"tahoma\" size=\"1\">$entryName
";
echo "
";
echo "
";
$toopen=$dirname . "/" . $images[$i];
echo "
";
$theImg="/NewDirAcc" . $dirname . "/" . $images[$i];
echo "height=\"30\">
";
echo "$images[$i]

";
echo "
";
echo "
";
echo "
";
echo "
";
echo "
";
echo "
";
echo "

";
echo "


";
echo "

";
?>
"; ?>

Add Directory:



"; ?>

Delete Directory:




Image:

Not Working Yet!

to do: Also read directories into an array first like with the images. Then we can list
alphabetically
too!!! Need to do the upload (simple) then thats pretty much it...