I have this script that works good, but I need to add a command for searching on all subfolders.
Example: I have a folder data and this contains more another folders... I need to search files on this folders.
$dir = 'data';
$exclude = array('.', '..', '.htaccess');
$q = (isset($_GET['q'])) ? strtolower($_GET['q']) : '';
$res = opendir($dir);
while(false !== ($file = readdir($res))) {
if(strpos(strtolower($file), $q) !== false &&!in_array($file, $exclude)) {
echo "<a href='$dir/$file'>$file</a>";
echo "<br>";
}
}
closedir($res);