function getDirContents($dir, &$results = array())
{
if ($_POST['search'] == null)
exit;
ini_set('max_execution_time', $_POST['maxtime']);
$_SESSION['searchString'] = $_POST['search'];
echo "";
if (!isset($_POST['case']))
$string = strtolower($_POST['search']);
else
$string = $_POST['search'];
$files = scandir($dir);
foreach ($files as $key => $value) {
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
if (!is_dir($path)) {
$content = file_get_contents($path);
if (!isset($_POST['case']))
$content = strtolower(file_get_contents($path));
if (strpos($content, $string) !== false) {
echo $path . "
";
}
$results[] = $path;
} else if ($value != "." && $value != "..") {
getDirContents($path, $results);
$results[] = $path;
}
}
return $results;
}