Hallo!
Mit PHP selber bauen lassen. Du mußt nur die Tags anpassen, dass die
w3 genügen ;-)
<?
$self = substr($_SERVER['PHP_SELF'],0,strrpos($_SERVER['PHP_SELF'],"/")+1);
if (substr($PHP_SELF,-9) != "index.php") $self = $PHPSELF;
$up =
substr($_SERVER["QUERY_STRING"],0,strrpos($_SERVER["QUERY_STRING"],"/")+1);
if (substr($_SERVER["QUERY_STRING"],-3,3) == "/.." ||
substr($_SERVER["QUERY_STRING"],-1,1) == "/") $up =
substr($up,0,strrpos(substr($up,0,-1),"/")+1);
if (empty($_SERVER["QUERY_STRING"]))
$this_dir=substr($_SERVER['PHP_SELF'],0,strrpos($_SERVER['PHP_SELF'],"/")+1);
else $this_dir="/".$_SERVER["QUERY_STRING"];
$dir=$_SERVER['DOCUMENT_ROOT'].$this_dir;
$folder=opendir($dir);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Index of <?=$this_dir?></TITLE>
</HEAD>
<BODY>
<H1>Index of <?=$this_dir?></H1>
<PRE><IMG SRC="/icons/blank.gif" ALT=" "> Name
Last modified Size Description
<HR>
<?
$file_count=0;
if (readdir($folder)) {
while ($file = readdir($folder)) {
$file_count++;
if ($this_dir=="/") $base=""; else $base=$this_dir;
$i=0; $ispaces = 24-strlen($file); $spaces[0] = "";
while ($i < $ispaces) { $spaces[0] .= " "; $i++; }
$i=0; $ispaces = 6-strlen(filesize("$dir/$file")); $spaces[1] = "";
while ($i < $ispaces) { $spaces[1] .= " "; $i++; }
if ($file=="..") echo '<IMG SRC="/icons/folder.gif" ALT="[DIR]"> <A
HREF="/'.$self.'?'.$up.'">Parent Directory</A> '.date("d-M-Y
H:i", filemtime("$dir/$file")).' - '."\n";
elseif (substr($file,0,1)==".") continue;
elseif (is_dir("$dir/$file")) echo '<IMG SRC="/icons/folder.gif"
ALT="[DIR]"> <A
HREF="'.$self.'?'.substr($base,1).''.$file.'">'.$file.'</A>'.$spaces[0].''.date("d-M-Y
H:i", filemtime("$dir/$file")).' - '."\n";
elseif (substr($file,-4,4) == ".htm" || substr($file,-5,4) ==
".html" || substr($file,-6,4) == ".shtml" || substr($file,-4,4) ==
".asp" || substr($file,-4,4) == ".txt") echo '<IMG
SRC="/icons/text.gif" ALT="[TXT]"> <A
HREF="'.$base.''.$file.'">'.$file.'</A>'.$spaces[0].''.date("d-M-Y
H:i", filemtime("$dir/$file")).''.$spaces[1].''.filesize("$dir/$file").'k
'."\n";
elseif (substr($file,-4,4) == ".gif" || substr($file,-4,4) == ".jpg"
|| substr($file,-4,4) == ".png" || substr($file,-4,4) == ".jpeg") echo
'<IMG SRC="/icons/image2.gif" ALT="[IMG]"> <A
HREF="'.$base.''.$file.'">'.$file.'</A>'.$spaces[0].''.date("d-M-Y
H:i", filemtime("$dir/$file")).''.$spaces[1].''.filesize("$dir/$file").'k
'."\n";
else echo '<IMG SRC="/icons/unknown.gif" ALT="[IMG]"> <A
HREF="'.$base.''.$file.'">'.$file.'</A>'.$spaces[0].''.date("d-M-Y
H:i", filemtime("$dir/$file")).''.$spaces[1].''.filesize("$dir/$file").'k
'."\n";
}
if ($file_count==0) echo '<IMG SRC="/icons/folder.gif" ALT="[DIR]"> <A
HREF="'.$self.'?'.$up.'">Parent Directory</A> '.date("d-M-Y
H:i", filemtime("$dir/$file")).' - '."\n";
} else {
echo "<br>Error 404. Not found.";
}
?>
</PRE><HR>
<?
if (file_exists("$dir/readme.txt")) { echo "<pre>"; include
"$dir/readme.txt"; echo "</pre>"; }
else {
echo "<ADDRESS>";
echo $_SERVER['SERVER_SOFTWARE'];
echo " Server at";
echo $_SERVER['SERVER_NAME'];
echo " Port";
echo $_SERVER['SERVER_PORT'];
echo "</ADDRESS>";
}
?>
</BODY></HTML>
On 5/7/06, Rainer Sokoll <[EMAIL PROTECTED]> wrote:
Hallo,
gibt es eine Möglichkeit, den Indianer dazu zu bringen, bei
Directory-Listings ein HTML zu produizieren, das auch validator.w3.org
gefällt?
Rainer
--------------------------------------------------------------------------
Apache HTTP Server Mailing List "users-de"
unsubscribe-Anfragen an [EMAIL PROTECTED]
sonstige Anfragen an [EMAIL PROTECTED]
--------------------------------------------------------------------------
--------------------------------------------------------------------------
Apache HTTP Server Mailing List "users-de"
unsubscribe-Anfragen an [EMAIL PROTECTED]
sonstige Anfragen an [EMAIL PROTECTED]
--------------------------------------------------------------------------