need help for customizing PHP-grep files search

Submitted by Anonymous (not verified) on Mon, 08/09/2010 - 08:47

can somebody please help me with this issue...

i have installed PHP-grep on my website and it works well.. but that i need a little change in the script so that it displays the file with hyperlink in it instead of displaying the actual path.

would be really helpful if somebody help me..
below is the code that i have in my site www.linktoprofessionals.com/files

/**
* powered by @cafewebmaster.com
* free for private use
* please support us with donations
*/

define("SLASH", stristr($_SERVER[SERVER_SOFTWARE], "win") ? "\\" : "/");

$path = ($_POST[path]) ? $_POST[path]: dirname(__FILE__);
$q = $_POST[q];

function php_grep($q, $path){

$fp = opendir($path);
while($f = readdir($fp)){
if( preg_match("#^\.+$#", $f) ) continue;
$file_full_path = $path.SLASH.$f;
if(is_dir($file_full_path)) {
$ret .= php_grep($q, $file_full_path);
} else if( stristr(file_get_contents($file_full_path), $q) ) {
$ret .= "$file_full_path\n";
}
}
return $ret;
}

if($q){
$results = php_grep($q, $path);
}

echo <<

	
Query
$results

HRD;

?>

Add new comment