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>'; </form>';
echo '<br>'; 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($path, '.del'))
{ {
if (!str_ends_with($file, '.del') && $file != '.' && $file != '..') $name = basename($path);
{ $mod = date("F d Y H:i:s", filemtime($path));
$mod = date("F d Y H:i:s", filemtime($dir . '/' . $file)); echo '<div>' . $mod . '&nbsp;<a href=index.php?open=' . urlencode($name) . '>' . $name .'</a></div>';
echo '<div>' . $mod . '&nbsp;<a href=index.php?open=' . urlencode($file) . '>' . $file .'</a></div>';
}
} }
closedir($dh);
} }
echo '<br>'; echo '<br>';
} }
?> ?>
</body> </body>
</html> </html>