"; //define the path as relative $path = "."; $webpath ="Type your domain name here. Eg:http://www.diovo.com/"; //using the opendir function $dir_handle = @opendir($path) or die("Unable to open $path"); echo "Directory Listing of $path
"; list_dir($dir_handle,$path,$filename,$content_pattern); function list_dir($dir_handle,$path,$filename_pattern,$content_pattern) { // print_r ($dir_handle); echo "
    "; //running the while loop while (false !== ($file = readdir($dir_handle))) { $dir =$path.'/'.$file; if(is_dir($dir) && $file != '.' && $file !='..' ) { $handle = @opendir($dir) or die("undable to open file $file"); list_dir($handle, $dir, $filename_pattern, $content_pattern); }elseif($file != '.' && $file !='..') { if(strcmp("$file", "$filename_pattern")==0){ echo "
  1. $webpath.$dir
  2. "; $handle = @fopen($dir, "r"); if ($handle) { while (!feof($handle)) { $content = fgets($handle); $test = stristr($content, $content_pattern); echo $test; } fclose($handle); } } } } echo "
"; closedir($dir_handle); } ?>