[php] readdir sortieren...
Verfasst: 13.02.2007 23:01
Hi!
ich hab hier ne tolle funktion, nur leider kommen die dateien unsortiert raus und ich möchte sie von a-z sortiert haben:
es geht halt vor allem um das readdir... 
ich hoffe, ihr könnt mir helfen und verweist nicht auf iwelche tuts, da ich die meisten, die ich kenne schon durchgeschaut hab und nichts gefunden...
danke im vorraus,
gruß!
asmodiel
ich hab hier ne tolle funktion, nur leider kommen die dateien unsortiert raus und ich möchte sie von a-z sortiert haben:
Code: Alles auswählen
function image_list($dir)
{
echo "<table border='1' width='800' class='main' cellpadding=3 cellspacing=0>";
echo "<tr><td class='catLeft'><b>List of Files in $dir</b></td>";
echo "<td class='catLeft'><p align='center'><b>Befehle</b></p></td>";
echo "<td class=catLeft align=center><b>Dateigröße</b></td>";
echo "<td class=catLeft align=right><b>Bearbeitet am:</b></td></tr>";
echo "<tr><td><a href=uploads/games/>Games/</a></td><td align=center> </td><td align=center>Ordner</td><td> </td></tr>";
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false )
{
$path = $dir.$file;
if ( $file != 'Thumbs.db' && $file != 'index.html' && $file != 'upload.ico' && $file != 'cellpic1.gif' && is_file($path) )
{
//Befehllinks
echo "<tr>";
//Dateiname
echo "<td><a href=".$dir.$file.">". $file . " </a></td>\n";
echo "<td align='center'><a href='download.php?file=$file'>Download</a>";
echo " :: ";
echo "<a href='rename.php?get=$file'>Umbenennen</a>";
echo " :: ";
echo "<a href=confirm.php?get=$file>Löschen</a></td>";
//Dateigröße
file_size($path);
//Geändert am
$ctimestamp = filectime($dir.$file);
$ctime = date('m.d.Y h:i:s a', $ctimestamp);
echo "<td align=right>$ctime</td>";
echo "</tr>";
}
}
closedir($dh);
}
}
echo "</table>";
}

ich hoffe, ihr könnt mir helfen und verweist nicht auf iwelche tuts, da ich die meisten, die ich kenne schon durchgeschaut hab und nichts gefunden...
danke im vorraus,
gruß!
asmodiel