1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
<html>
<head></head>
<style>
.fichier {
font-weight:bold;
font-size: 11px;
font-family: arial, sans-serif;
color:#000000;}
.dossier {
font-weight:bold;
font-size: 12px;
font-family: arial, sans-serif;
color:#009900;}
body {cursor: default;background-color:#FFFFFF;}
a:link{Text-Decoration:none; color : #000000;}
a:active{Text-Decoration:none; color : #000000;}
a:visited{Text-Decoration:none; color : #000000;}
a:hover{cursor: default;color:#000000;Text-Decoration:underline;}
</style>
<body>
<div>
<?php
$pathimage = 'images/'; // dossier image pour extention
$taile_image ='16'; //taille de l'icone extention
$dir_nom = 'dossiers/.'; // dossier listé (pour lister le répertoir courant : $dir_nom = '.' --> ('point')
$dir = opendir($dir_nom) or die('Erreur de listage : le répertoire n\'existe pas'); // on ouvre le contenu du dossier courant
$fichier= array(); // on déclare le tableau contenant le nom des fichiers
$dossier= array(); // on déclare le tableau contenant le nom des dossiers
$sous_dossier= array(); // on déclare le tableau contenant le nom des dossiers
while($element = readdir($dir))
{
if($element != '.' && $element != '..')
{
if (!is_dir($dir_nom.'/'.$element))
{$fichier[] = $element;}
else
{$dossier[] = $element;}
}
}
closedir($dir);
if(!empty($dossier))
{
sort($dossier); // pour le tri croissant, rsort() pour le tri décroissant
foreach($dossier as $lien)
{echo "<img src='images/dossier.png' width='".$taile_image."' head='".$taile_image."'><a href=\"$dir_nom/$lien \">$lien</a><br>";}
}
if(!empty($fichier)){
sort($fichier);// pour le tri croissant, rsort() pour le tri décroissant
foreach($fichier as $lien)
{ $pathinfo = pathinfo($lien);
if ($pathinfo['extension']=='xlsx')
{echo "<img src='".$pathimage."excel.png' width='".$taile_image."' head='".$taile_image."'></a>";}
elseif ($pathinfo['extension']=='jpg')
{echo "<img src='".$pathimage."jpg.png' width='".$taile_image."' head='".$taile_image."'></a>";}
elseif ($pathinfo['extension']=='tif')
{echo "<img src='".$pathimage."tiff.png' width='".$taile_image."' head='".$taile_image."'></a>";}
elseif ($pathinfo['extension']=='docx')
{echo "<img src='".$pathimage."word.png' width='".$taile_image."' head='".$taile_image."'></a>";}
elseif ($pathinfo['extension']=='doc')
{echo "<img src='".$pathimage."word.png' width='".$taile_image."' head='".$taile_image."'></a>";}
elseif ($pathinfo['extension']=='xls')
{echo "<img src='".$pathimage."excel.png' width='".$taile_image."' head='".$taile_image."'></a>";}
elseif ($pathinfo['extension']=='dxf')
{echo "<img src='".$pathimage."dxf.png' width='".$taile_image."' head='".$taile_image."'></a>";}
elseif ($pathinfo['extension']=='dwg')
{echo "<img src='".$pathimage."dwg.png' width='".$taile_image."' head='".$taile_image."'></a>";}
elseif ($pathinfo['extension']=='pdf')
{echo "<img src='".$pathimage."pdf.png' width='".$taile_image."' head='".$taile_image."'></a>";}
if ($pathinfo['extension']=='php'){}
else{echo "<a class='media' href=\"$lien \" target='_blank'>$lien</a><br>";}
}
}
?>
</div>
</body>
</html> |