Merci @++
PS: je peux plus m'apeller wolverine!?!?!?!? Bizard lol (je viens de formater ca change un truque?)
<?php
$rep = "./galerie";
$dir = opendir($rep);
function dd($date) {
return date("d/m/Y H:i:s",$date);
}
while ($f = readdir($dir))
{
if ($f !="." && $f != "..")
{
if(is_dir($rep."/".$f)) {
echo "<a href=\"".$rep."/".$f."\">".$f."</a><br>\n";
}
}
}
closedir($dir);
?>
Deux choses: quand tu mets du code, vérifie que les bbCodes sont activés et utilises les bouton [ PHP ] au dessus du formulaire de message.
<?php
$base = "/var/www";
$rep = $_GET["rep"] ? $_GET["rep"] : "/";
$path = realpath($base . $rep);
if (!is_dir($path)) {
$rep = "/";
$path = realpath($base . $rep);
}
$rep = substr($path, strlen($base) + 1);
if (substr($rep, 1) != "/") { $rep = "/" . $rep; }
if (substr($rep, -1) != "/") { $rep = $rep . "/"; }
if (!stristr($path, $base)) {
header("Location: " . $_SERVER["PHP_SELF"]);
exit();
}
$list = array();
$folders = array();
$files = array();
$folder = opendir($path);
while ($name = readdir($folder)) {
if (($name != "..") && ($name{0} == ".")) { continue; }
array_push($list, $name);
}
closedir($folder);
for ($idx = 0; $idx < count($list); $idx++) {
$absolute = realpath($path . "/" . $list[$idx]);
$type = filetype($absolute);
if ($type == "dir") {
array_push($folders, $list[$idx]);
} elseif ($type == "file") {
array_push($files, $list[$idx]);
}
}
sort($folders);
sort($files);
for ($idx = 0; $idx < count($folders); $idx++) {
$name = $folders[$idx];
echo "<a href='$_SERVER[PHP_SELF]?rep=$rep$name'>$name</a><br>\n";
}
for ($idx = 0; $idx < count($files); $idx++) {
$name = $files[$idx];
echo "file: $name<br>\n";
}
?>