Parent';
if ((substr($reqdir, 0, 7) == 'scripts' && strlen($reqdir) < strlen('scripts/.')) ||
(substr($reqdir, 0, 8) == 'graphics' && strlen($reqdir) < strlen('graphics/.')) ||
(strlen($reqdir) < 7)) {
$parentlink = '';
}
$mrr = '';
$mrr = $mrr . getDirMrr($reqdir, $hosturl, $hrefdir, $physdir);
$mrr = ''
. $parentlink
. $mrr . '
';
if ($format == 'html') {
$mrr = ''
. ''
. 'Index of ' . $hosturl . $hrefdir . ''
. ''
. ''
. ''
. ''
. $mrr
. ''
. '';
header('Content-type: text/html');
}
echo $mrr;
function getDirMrr($reqdir, $hosturl, $hrefdir, $physdir) {
$mrr = '';
if (substr($reqdir, -1) != '/' && substr($reqdir, -1) != '\\') {
$reqdir = $reqdir . '/';
}
if (substr($hrefdir, -1) != '/' && substr($hrefdir, -1) != '\\') {
$hrefdir = $hrefdir . '/';
}
if (substr($physdir, -1) != '/' && substr($physdir, -1) != '\\') {
$physdir = $physdir . '/';
}
if ($handle = opendir($physdir)) {
$files = array();
while (($file = readdir($handle)) !== false) {
array_push($files, $file);
}
closedir($handle);
sort($files, SORT_REGULAR);
$mrr = '';
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if (!is_file($physdir . $file)) {
$mrr = $mrr . '- ' . $file . '';
$mrr = $mrr . getDirMrr($reqdir . $file, $hosturl, $hrefdir . $file, $physdir . $file);
$mrr = $mrr . '
';
}
}
}
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if (is_file($physdir . $file)) {
$mrr = $mrr . '- ' . $file . '';
$mrr = $mrr . '
';
}
}
}
$mrr = $mrr . "
";
}
return $mrr;
}
?>