change sort by date

This commit is contained in:
quenousimporte 2024-02-14 16:59:19 +01:00
parent 361cb3849e
commit d007101e08
1 changed files with 11 additions and 9 deletions

View File

@ -93,21 +93,23 @@
</form>';
echo '<br>';
if ($dh = opendir($dir))
$files = glob($dir . '/*');
usort($files, function($a, $b)
{
while (($file = readdir($dh)) !== false)
return filemtime($b) - filemtime($a);
});
foreach($files as $path)
{
if (!str_ends_with($file, '.del') && $file != '.' && $file != '..')
if (!str_ends_with($path, '.del'))
{
$mod = date("F d Y H:i:s", filemtime($dir . '/' . $file));
echo '<div>' . $mod . '&nbsp;<a href=index.php?open=' . urlencode($file) . '>' . $file .'</a></div>';
$name = basename($path);
$mod = date("F d Y H:i:s", filemtime($path));
echo '<div>' . $mod . '&nbsp;<a href=index.php?open=' . urlencode($name) . '>' . $name .'</a></div>';
}
}
closedir($dh);
}
echo '<br>';
}
?>
</body>
</html>