All pastes #921241 Raw Edit

Anonymous

public php v1 · immutable
#921241 ·published 2008-02-27 22:10 UTC
rendered paste body
<?$array=Array(Array(),Array());if ($dh = opendir(".")) { // alors, si on peut l'ouvrir$i=0;       while (($file = readdir($dh)) !== false) { // alors si on peut lire les fichiers$array_extension = explode(".", $file);  // separer le nom en suivant les points$extension=$array_extension[count($array_extension)-1];  // le dernier est l'extensionif( strtolower($extension)=="ogg" ||  strtolower($extension)=="mp3" || strtolower($extension)=="wma") {  // si l'extension est correcte et que le fichier n'est pas un dossier$array[0][$i]=filemtime($file);$array[1][$i]=$file;$i++;}        }       closedir($dh); // quand on a tout lu (fin du while), on ferme le dossier   }//sort!$sortarray=$array[0];sort($sortarray);$newarray=Array(Array(),Array());for($i=0;$i<count($array[0]);$i++)  {for($i2=0;$i2<count($array[0]);$i2++)  {if($sortarray[$i]==$array[0][$i2]) {$newarray[0][$i]=$array[0][$i2];$newarray[1][$i]=$array[1][$i2];}}}//!sortecho "<table><tr><td>Fichier</td><td>Ajout</td></tr>";for($i=0;$i<count($array[0]);$i++)  {echo "<tr><td><a href='".$newarray[1][$i]."'>".$newarray[1][$i]."</a></td><td>".strftime("%A %B %d, %Y",  $newarray[0][$i])."</td></tr>";}echo "</table>";?>