<?


if ($handle = opendir('.'))

{

  while (false !== ($file = readdir($handle)))

  {

    if ($file[0] != "." && $file != "index.php")

    {

      if(is_dir($file))

      {

        $dirarr[] = $file;

      }

      else

      {

        $filearr[] = $file;

      }

    }

  }

  closedir($handle);

}


sort($dirarr);

sort($filearr);


echo "<HTML><HEAD><TITLE>Open Dir</TITLE></HEAD><BODY>\n";

echo "<b>Directories:</b><br>\n";

foreach($dirarr as $file) { echo "<a href=\"$file\">$file</a> <br />\n"; }

echo "<br><b>Files:</b><br>\n";

foreach($filearr as $file) { echo "<a href=\"$file\">$file</a> <br />\n"; }

?>