hi guys im looking for a script that will allow users to enter a keyword in an html form which will then be used as a search word within a directory so if the person searches mp3 it would return a list of files named containing the NAME mp3. ive found a script online that does this but it has one problem - it only searches for content within the root folder and doesnt include sub directories.
any help would be greatly appreciated ( i have no PHP knowledge )
[php]<?php
//////////////////////
// © Nadav Ami 2009 //
// Version 1.2 //
//////////////////////
$dirname dir(".");
$findme = $_POST[“search”];
$dir = opendir($dirname);
while(false != ($file = readdir($dir))){//Loop for every item in the directory.
if(($file != “.”) and ($file != “…”) and ($file != “.DS_Store”) and ($file != “search.php”))//Exclude these files from the search
{
$pos = stripos($file, $findme);
if ($pos !== false){
$thereisafile = true;//Tell the script something was found.
echo’’ . $file . ‘
’;//Display the search results as links.
}else{
//Leave this blank
}
}
}
if (!isset($thereisafile)){
echo “Nothing was found.”;//Tell the user nothing was found.
echo ‘’;//Display an image, when nothing was found.
}
?>
[/php]