rendered paste body<?php
$dir = './';
$handle = opendir($dir);
$file_list = array();
while (($file = readdir($handle)) !== false)
{
if(!in_array($file, array('.', '..')) AND is_file($dir . $file))
{
$file_list[] = basename($file, '.php');
}
}
closedir($handle);
natcasesort($file_list); // do a natural sort
$file_list = array_values($file_list); //reindex the array 0, 1, 2... so the following loop will work
$rows = 50; // how many rows in a column
$row = array(); // array to hold each row
$cnt = count($file_list); // total number of files
$row_number = 0;
for($index = 0; $index < $cnt; $index++){
$Diff = (time() - filemtime("$file_list[$index]"))/60/60/24;
if ($Diff>2)//TODO
{
$row[$row_number] .= "<td valign=\"top\" width=\"200\"><b><a href=\"" . $file_list[$index] . ".php\">".$file_list[$index]."</b></td>";
} else
{
$row[$row_number] .= "<td valign=\"top\" width=\"200\"><a href=\"" . $file_list[$index] . ".php\">".$file_list[$index]."</td>";
}
$row_number++;
if($row_number >= $rows){
$row_number = 0; // reset for next column
}
}
$message = "<table border=1>";
foreach($row as $value){
$message .= "<tr>";
$message .= $value;
$message .= "</tr>\n";
}
$message .= "</table>";
echo $message;
?>