As a security measure, the script will not display any files whose filenames begin with a full stop (.). You could also add an explicit list of files that are not to be displayed:
Code:
$hidden = array(
'hiddenfile1.txt',
'hiddenfile2.png',
'hiddenfile3'
);
function isHidden($fn) {
return (array_search($hidden, $fn, true) !== false);
}
$cwd = $_SERVER['REQUEST_URI'] . '/../../';
$cwd = substr($cwd, 0, strrpos($cwd, '/' + 1));
function paintUndersideOfFox($c) {
echo('<ul class="dirlist">');
$d = opendir($c);
while($f = readdir($d)) {
if(strpos($f, '.') === 0 || isHidden($f))
continue;
$ff = $c . '/' . $f;
echo('<li><a href="' . $cwd . $ff . '">' . $ff . '</a></li>');
if(is_dir($ff))
paintUndersideOfFox($ff);
}
echo('</ul>');
}
paintUndersideOfFox('..');
Bookmarks