<html>
<noads>
<?php
$d = dir( getcwd() );
echo "Handle: " . $d->handle . ", Path (not necessarily accurate): " . $d->path . "\n<br>";
echo "<title>" . $d->path . "/</title>";
$dh = opendir( getcwd() );
while (false !== ($file = readdir($dh)))
{
if( $file != "." && $file != ".." ) //don't test the root directories
{
if( is_file($file) )
{ $filelist[] = $file; }
else
{ $dirlist[] = $file; }
}
}
echo "\n" . getcwd() . " contains " . sizeof($filelist) . " files and " .
sizeof($dirlist) . " directories\n<br>\n";
echo "<table>\n"; //a table for our dir/file names & sizes
if( $dirlist[0] != NULL ) //maybe there are no directories
{
sort($dirlist);
foreach ($dirlist as $value)
{
echo "<tr>";
echo "<td><a href=\"" . $value . "\">" . $value . "</a></td>";
echo "<td> </td>";
echo "<td>" . date("dMy H:s T", filemtime($value)) . "</td>";
echo "</tr>\n";
}
}
sort($filelist);
foreach ($filelist as $value)
{
echo "<tr>";
echo "<td><a href=\"" . $value . "\">" . $value . "</a></td>";
echo "<td> </td>";
echo "<td>" . filesize($value) . " bytes</td>";
echo "<td> </td>";
echo "<td>" . date("dMy H:s T", filemtime($value)) . "</td>";
echo "</tr>\n";
}
echo "</table>";
closedir($dh);
$d->close();
echo "\n";
?>
</html>