Mam taki kod:
<?php
// Show size of each file, 1 for YES, 0 for NO
$showsize = 1;
// Array with file types to display and the images to use.
// Syntax: $display['filetype'] = "image";
$display['php'] = "php.gif";
$display['html'] = "html.gif";
$display['htm'] = "html.gif";
$display['shtml'] = "html.gif";
// Array with directories to exclude.
// Syntax: $excludedir[] = "directory";
$excludedir[] = "cgi-bin";
$excludedir[] = "images";
$excludedir[] = "realaudio";
$excludedir[] = "style";
// Array with files to exclude.
// Syntax: $excludefile[] = "filename";
$excludefile[] = "phpinfo.php";
// Set some important stuff
$pre = explode("/", $_SERVER['REQUEST_URI']); $prefix = join("/", $pre);
// Uncomment the 2 lines below to create a tree of all files and directories on
// your webserver if the script is in a subdirectory
$prefix = "";
$root .= "/";
// Display server name and directory
echo "<table width="80%" class="sitemap_tag2
" ellspacing="0" cellpadding="0" border="0">n"; echo "<tr><td><img align="absmiddle
" src="server
.gif
" border="0"> <b>http://".$_SERVER['SERVER_NAME']; echo "</b></td></tr><tr><td><img align="absmiddle
" src="vertical
.gif
" border="0"></td></tr>n";
function get_extension($name) {
return $retval;
}
// Recursion! And away we go...
// Set some globals and clean up a bit...
// What a pig...
function list_dir($chdir) {
global $root, $prefix, $showsize, $display, $excludedir, $excludefile;
// Open the current directory
// Read directory. If the item is a directory, place it in $sdirs.
// If it's a filetype we want, put it in $sfiles */
{
if(is_dir($file) && $file != "." && $file != ".." && !in_array($file, $excludedir)) { $sdirs[] = $file; }
{ $sfiles[] = $file; }
}
// Count the slashes to determine how deep we're in the directory.
// Add lines to make it pretty.
// Display directory names and recursively list them.
for($y=0; $y<sizeof($sdirs); $y++) {
for($z=1; $z<=$count; $z++)
{ echo "<img align="absmiddle
" src="vertical
.gif
" border="0"> "; } { echo "<img align="absmiddle
" src="verhor
.gif
" border="0">"; } else
{ echo "<img align="absmiddle
" src="verhor1
.gif
" border="0">"; } echo "<img align="absmiddle
" src="folder
.gif
" border="0"> <B>$sdirs[$y]</B>"; list_dir($dir."/".$sdirs[$y]);
}
}
// Run through the array of files and show them.
// What file types shall we display?
for($y=0; $y<$sizeof; $y++) {
for($z=1; $z<=$count; $z++)
{ echo "<img align="absmiddle
" src="vertical
.gif
" border="0"> "; } if($y == ($sizeof -1))
{ echo "<img align="absmiddle
" src="verhor1
.gif
" border="0">"; } else
{ echo "<img align="absmiddle
" src="verhor
.gif
" border="0">"; } echo "<img align="absmiddle
" src=""; echo $display[get_extension($sfiles[$y])];
echo "" border="0"> ";
// pokazuje pliki
echo "<a href="".$HTTP_REFERER."$prefix/$dir1$sfiles[$y]" target="_new
">$sfiles[$y]</a>"; if($showsize) {
}
}
for($z=1; $z<=$count; $z++)
{ echo "<img align="absmiddle
" src="vertical
.gif
" border="0"> "; } }
}
list_dir($root);
// How long did that take?
$time = round(($ftime[sec
] + $ftime[usec
] / 1000000
) - ($stime[sec
] + $stime[usec
] / 1000000
), 5
); echo "<div align="center
" class="sitemap_tag2
">This page was generated in $time seconds.</div>n"; ?>
ładnie pokazywana jest cała struktura katalogó+podkatalogów+plików, ale problem jest taki, że np. przy plikach link jest generowany tak:
http://localhost/z:/home/localhost/www/fol...folder/plik.phpgdzie to można zmienić?