Thanks to someone on PHP.net's opendir() function page, I found this
PHP Code:
<?php
//define the path as relative
$path = "path to directory";
$webpath ="the url you want to place before your filename/";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
echo "Directory Listing of $path<br/>";
list_dir($dir_handle,$path);
function list_dir($dir_handle,$path)
{
// print_r ($dir_handle);
echo "<ol>";
//running the while loop
while (false !== ($file = readdir($dir_handle))) {
$dir =$path.'/'.$file;
if(is_dir($dir) && $file != '.' && $file !='..' )
{
$handle = @opendir($dir) or die("undable to open file $file");
echo "<li><a href='$webpath.$file'>$file</a></li>";
list_dir($handle, $dir);
}elseif($file != '.' && $file !='..')
{
echo "<li><a href='$webpath.$file'>$file</a></li>";
}
}
echo "</ol>";
//closing the directory
closedir($dir_handle);
}
?>
with a little work, you should be able to easily modify this to your needs ;)
PS. using this method, check that $file == 'config.php', then do a $output = file_get_contents() to output the content and then check the file using either preg_match() or stristr() to check the setting you need.