Bonjour,
je souhaiterai obtenir de l'aide pour la realisation d'un listage du contenu d'un repertoire ( de preference en php) comme sur ce exemple http://dept-info.labri.fr/ENSEIGNEMENT/ . merci pour vos contribution .
<?php
$ndf='index.php'; //Nom de ce script
function taille($file)
{
if(is_dir($file))
{
return "Dossier";
break;
}
else
{
$taille=filesize($file);
if($taille<=1024)
return "$taille octets";
elseif($taille<=1024*1024)
{
$taille=round($taille/1024,2);
return "$taille Kio";
}
elseif($taille<=(1024^3))
{
$taille=round($taille/1024/1024,2);
return "$taille Mio";
}
else
{
$taille=round($taille/1024/1024/1024,2);
return "$taille Gio";
}
}
}
?>
<html>
<head>
<title>Index</title>
<style>
.tableau {border-style:solid; background-color:#EFEFEF; border-width:3px; border-color:#ABCDEF; font-family:verdana, arial, sans-serif; font-size:11px; text-align:center}
</style>
</head>
<body>
<table class="tableau" border="1" align="center" width="60%">
<tr><td> Fichier </td><td>Extension</td><td>Poids</td><td>Dernière modification</td></tr>
<?php
$mois=date("m-Y");
$today=date("d-m-Y",time());
$files=array();
$dir=opendir("."); //Ouvrir le répertoire courant
while(false!==($file=readdir($dir)))
{
$poids=taille($file); //Calculer le poids du fichier courant
array_push($files,$file); //Ajouter le fichier courant à la liste de fichiers
$lastmod=getlastmod($file);
$lastmod=date('M,d Y',$lastmod);
if(is_file($file) AND $file!=$ndf)
{
$expfile=explode('.',$file); //Séparer le nom de fichier de son extension
$filename=$expfile[0];
$ext=strtoupper($expfile[1]);
echo "<tr><td><a href=\"$file\">$filename</a></td><td>$ext</td><td>$poids</td><td>$lastmod</td></tr>";
}
elseif(is_dir($file) AND $file!="." AND $file!="..") //Ne pas rentrer les répertoires courant et parent dans le tableau
{
$ext="Dossier";
$filename=$file; //Conserve le nom de dossier
if(is_dir($file)) $file='./'.$file; //Ajouter un point/slash devant les dossiers
echo "<tr><td><a href=\"$file\">$filename</a></td><td>$ext</td><td>$poids</td><td>$lastmod</td></tr>";
}
}
?>
</table>
</body>
</html>
Combien cela coûte-t-il au total ? Quelles aides apportent l'état et les acteurs du marché pour alléger cette charge non choisie ? Tous les détails sur Commentçamarche.net.
Mais il est possible que l'hébergeur ait carrément interdit l'option. je ne sais pas trop.
bon je editer effectivement un fichier .htaccess comme ceci:
<Directory "Un rep du site">
Options +Indexes +Includes +FollowSymlinks +MultiViews
AllowOverride Authconfig
Order allow,deny
Allow from all
</Directory>
Le probleme est qu'il ne marche pas du tous, voici ce que j'obtiens coté clients:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, wabmaster@emi.u-bordeaux.fr and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Je pense que l'hebergeur a interdi cette action. merci de renseigner d'avantage