<html><head><title>file listing in directory</title>
<meta http-equiv=content-type content="text/html; charset=windows-874">
</head><body>
<table width="90%" align="center">
<?
$dir_handle=opendir(".");
$retVal = array();
while ($file = readdir($dir_handle)) {
if ($file != "." && $file != ".." && $file != "index.html" && $file != "opendir.php" ) {
$k = filemtime("./$file").$file;
$retVal["$k"] = $file;
}
}
closedir($dir_handle);
sort($retVal);
//
$total = 0;
while (list($key, $list) = each($retVal)) {
$filesize = filesize("./$list");
$filetype = filetype("./$list");
$total += $filesize;
echo "<tr><td>+ <a href='$list' target=_blank>$list</a> ";
echo "<td align='right'>".date("Y-m-d h:ia",filemtime("./$list"));
echo "<td align='right'>".number_format($filesize,0,',',',');
}
echo "<tr><td colspan='3' align='right'>$total";
?>
</table>
จำนวน : 30 บรรทัด