<?php
echo "Code for this page <A HREF='listCode.php'>here</A>.";
//Load th edirectory names into an array.
    
$list = dir("./");
    
$i = 0;
    
$d = array();
    while ((
$file = $list->read()) !== false)
    {
        if(
$file != ".." && is_dir($file))
        {
            
$d[$i] = $file."/";
            ++
$i;
        }
    };
    
$list->close();

echo
"<TABLE border ='1' ><TR valign='top'>";

foreach (
$d as $dirName)
{
    echo
"<TD><B>".$dirName."<BR></B>";
//Open directory and loop thru
    
$dir = dir($dirName);
    while ((
$fileName = $dir->read()) !== false)
    {
        
$url = $dirName.$fileName;
        if(!
is_dir($fileName)) echo "<A HREF=". $url . " target='_blank'>".$fileName."</A><br />";
    }
    
$dir->close();
    echo
"</TD>";
};
echo
"</TR></TABLE>";
?>