check for index file<

liunx

Guest
what i want to do is when someone tries to submit a link to the site. I want to check to see if there is an index.html, index.htm, index.php or index.asp/aspx in the root directory they have provided. I have no idea on how I would do this, it is so I can cut down the administration of the links part of a site i am doing for a friend of mine (easier for her), can some one point me in the right direction to get this done... Thanks heaps in advancesomething like this

<?php
$dir = "/tmp/";

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if(eregi("index", $file)){
// if file is index then exit out
$isIndexFile = TRUE;
break;
} else {
// else we send an error here
$isIndexFile = FALSE;
}
}
closedir($dh);
}
}

if (!$isIndexFile){
echo" Sorry you don't have a index file of any kind";

}
?>thanks scoutt ill try that one out later
 
Back
Top