//(C) copyright Megrisoft //This script is released under the terms Megrisoft License. ?>
$stime = gettimeofday(); //This is just for the page generated in... at the bottom of the page. As executing the script may take some time with large pages, I thought it quite useful to add this. $root = getcwd(); $pre = explode("/", $REQUEST_URI); array_pop($pre); $prefix = join("/", $pre); //Determine whether the script runs in the root directory of the domain. If not, add director(y/ies) it's in as a prefix before the links echo "
http://$SERVER_NAME$prefix/ |
![]() | ";
for($z=1; $z<=$count; $z++)
{ echo " "; }
if(is_array($sfiles))
{ echo " "; }
else
{ echo " "; }
echo " $sdirs[$y] | ";
$cwd1[0] = $dir;
$cwd1[1] = $sdirs[$y];
$chdir = join("/", $cwd1);
list_dir($chdir);
//call the script itself in all directories found to recursively read all subdirectories
}
}
//if directories were found, display them in a tree
chdir($chdir);
//change back to the directory the files are in, we need to do this because in the loop above we've read all subdirectories and therefore changed the working directory
if(is_array($sfiles))
{
sort($sfiles);
reset($sfiles);
if(!isset($display))
{ $display = "both"; }
$sizeof = sizeof($sfiles);
for($y=0; $y<$sizeof; $y++)
{
if(ereg("php$", $sfiles[$y]) && ($display == "both" || $display == "PHP"))
{
echo "
";
for($z=1; $z<=$count; $z++)
{ echo " "; }
if($y == ($sizeof -1))
{ echo " "; }
else
{ echo " "; }
echo " ";
echo "$sfiles[$y] |
";
for($z=1; $z<=$count; $z++)
{ echo " "; }
if($y == ($sizeof -1))
{ echo " "; }
else
{ echo " "; }
echo " ";
echo "$sfiles[$y] |
";
//check which files to display and display them
for($z=1; $z<=$count; $z++)
{ echo " "; }
echo " |