/*
PHP Source Browser
by Greg MacLellan, 4/20/02
Updated 7/21/02 to support register_globals = off (oops :) )
Another fix 9/25/02 to fix some stuff i missed
This is just a VERY simple script to browse through a directory and it's sub-directories
and be able to show the source of any .php file
It has a tiny amount of security to prevent people from going to a directory that starts
with / or that contains ..
*/
$dir = (isset($_GET["dir"]) ? $_GET["dir"] : ".");
$file = (isset($_GET["file"]) ? $_GET["file"] : "");
if ((isset($dir) && ($dir[0] == "/")) || (str_replace("..","",$dir) != $dir)) {
echo "permission denied";
exit;
}
if ($file) {
show_source($dir."/".$file);
} else {
$dh = opendir($dir);
echo "Listing of ".$dir."
";
echo "