Ok, so this short php script is real usefull for if you have loads of subdirectories of completely different websites like i do. these can be webs for sale, or just random websites shrugs it's for your use :-)
Check the example pic for more details (upload after i post this)
But the basics are, change the $dir variable to the directory you want to search including "/home/www/" if you are on a general apache server (You can find this by simple editing a file in the generic Browser Control Panel, it will say what file you are editing, therefore giving the directory. Once you point the script towards the main directory, it will search any subdirectories, if it finds an "index.php" file within a subdirectory, it will give a link to it, and more info, else it will message an error message.
(Check back to example pic)
Where it says "$dir = THE_DIRECTORY_GOES_HERE;", it will be something like "/home/www/wfs.myartsonline.com/" which is what i use in the picture example.
Drop a comment if you need some help or have any queries :-) or simply a comment.
For a general example of this: http://wfs.myartsonline.com
Add this stylsheet if you want it (COMPLETELY OPTIONAL!)
<style>
body {
font-family: times;
}
h1 {
font-family: times;
}
a {
color: #000000;
background: #ffffff;
}
a:hover {
color: #ffffff;
background: #000000;
}
</style>
Example:
<?php
// Directory Listing //
// Script by Jonesy44 //
// www.hawkee.com //
$dir = THE_DIRECTORY_GOES_HERE;
// Edit me ^^ ! //
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (fnmatch("*.php", $file)) {
echo '';
}
elseif (fnmatch(".*", $file)) {
echo '';
}
else {
$indfile = '' .$file. '/index.php';
if (!file_exists($indfile)) {
echo '>> ' .$file. '<br>';
echo '<font color=grey style="font-size:11px;"> <b>Error:</b> No "index.php" file exists within this directory</font><br>';
}
else {
echo '>> <a href=/' .$file. '>' .$file. '</a><br>';
$size = round(filesize($indfile) / 1024, 2);
$mod = filemtime($indfile);
echo '<font color=grey style="font-size:11px;">File Size: ' .$size. 'KB; Last Modified: ' .date('jS F Y [g:i A]', $mod). ';</font><br>';
}
}
}
closedir($handle);
}
?>
http://uk.php.net/fnmatch
Scroll down for some talk on fnmatch() substitutes