<?php function AffDir($dirname,$basename) { $i = 0; $d = opendir($dirname); while (false!==($file = readdir($d))) if ($file[0] != ".") $listfile[++$i] = $file; $dirnametmp = substr($dirname, 0,(strlen($dirname))-1); $chemin = explode($dirnametmp,"/"); $sup = $chemin[1]; if ($dirname != $basename) echo "<a href='$__SELF__?modulepage=affdir&dir=$sup&base=$basename'>[Niveau supérieur]</a><br><br>"; if (count($listfile) <= 1) echo "<b>Aucun fichier dans ce répertoire !</b><br>"; else foreach($listfile as $file) if (is_dir("$dirname$file")) echo "<a href='$__SELF__?modulepage=affdir&dir=$dirname$file/&base=$basename'>[$file]</a ><br>"; else echo "<a href='$__SELF__?modulepage=affdir&dir=$dirname&base=$basename&image=$dirname$fi le&titre=$file'>$file</a><br>"; closedir($d); } AffDir($dir,$base); ?>