\n";
echo "Name | Last modified | Size |
\n";
if($path!='')
$path.="/";
$rep="./".$path;
$dir=@opendir($rep);
if(!$dir)
exit("fu : dir not found");
while(false!=($filename=@readdir($dir)))
$files[] = $filename;
//print_r($files);
@sort($files);
if($path != './' )
{
$prev_rep= substr($path,0,strrpos(substr($path,0, strlen($path)-1),"/"));
//echo substr($path,0, strlen($path)-1);
echo "\n";
echo " .. | \n";
echo "- | \n";
echo "
\n";
}
for ($j=0;$j<= count($files); $j++)
{
if(is_dir("./".$path.$files[$j]) && $files[$j][0] != '.' && $files[$j]!='' && $files[$j]!='madchat')
{
echo "\n";
echo " ".$files[$j]." | \n";
echo "".date("d-m-Y G:i",filemtime($rep.$files[$j]))." | \n";
echo "- | \n";
echo "
\n";
}
if(is_dir("./".$path.$files[$j]) && $files[$j]=='madchat')
{
echo "\n";
echo " Madchat | \n";
echo "".date("d-m-Y G:i",filemtime($rep.$files[$j]))." | \n";
echo "- | \n";
echo "
\n";
}
}
for ($j=0;$j<= count($files); $j++)
{
if(is_file("./".$path.$files[$j]) && $files[$j]!='index.php' && $files[$j][0]!='.' )
{
$ext=substr(strrchr($files[$j],"."),1); //on recuper l'extension du fichier
$ext=strtolower($ext);
switch($ext)
{
// en fonction de l'extension on choisi une icone
case 'jpg' :$img="./.img/img.gif";break;
case 'gif' :$img="./.img/img.gif";break;
case 'png' :$img="./.img/img.gif";break;
case 'bmp' :$img="./.img/img.gif";break;
case 'jpeg' :$img="./.img/img.gif";break;
case 'txt' :$img="./.img/text.gif";break;
case 'rtf' :$img="./.img/text.gif";break;
case 'doc' :$img="./.img/text.gif";break;
case 'pdf' :$img="./.img/pdf.gif";break;
case 'chm' :$img="./.img/pdf.gif";break;
case 'htm' :$img="./.img/generic.gif";break;
case 'html' :$img="./.img/generic.gif";break;
case 'php' :$img="./.img/generic.gif";break;
case 'zip' :$img="./.img/compressed.gif";break;
case 'ace' :$img="./.img/compressed.gif";break;
case 'rar' :$img="./.img/compressed.gif";break;
case 'bz2' :$img="./.img/compressed.gif";break;
case 'gz' :$img="./.img/compressed.gif";break;
case 'mp3' :$img="./.img/sound.gif";break;
case 'c' :$img="./.img/c.gif";break;
case 'cpp' :$img="./.img/c.gif";break;
case 'exe' :$img="./.img/binary.gif";break;
case 'bin' :$img="./.img/binary.gif";break;
case 'rpm' :$img="./.img/binary.gif";break;
case 'avi' :$img="./.img/movie.gif";break;
case 'mpg' :$img="./.img/movie.gif";break;
case 'mpeg' :$img="./.img/movie.gif";break;
default :$img="./.img/unknown.gif";
}
echo "\n";
echo " " . $files[$j] . " | \n";
echo "".date("d-m-Y G:i",filemtime($rep.$files[$j]))." | \n";
$taille=filesize($rep.$files[$j]);
// calcul de l'unite
if ($taille >= 1024)
{
$taille_res = round($taille / 1024);
$unite = "Ko";
}
else
{
$taille_res = $taille;
$unite = "octets";
}
echo "$taille_res $unite | \n";
echo "
\n";
}
}
@closedir($dir);
echo "
\n";
echo "