[ create a new paste ] login | about

Link: http://codepad.org/uj8kPDgx    [ raw code | fork ]

PHP, pasted on Apr 2:
<?php 
$find="advspecial()";

echo findThis('./PathToYourProject/',$find);


function findThis($path,$find){
	$return=array();
	ob_start();
	if ($handle = opendir($path)) {
		$i=0;
		while (false !== ($file = readdir($handle))) {
			if ($file != "." && $file != "..") {
				if(is_dir($path.'/'.$file)){
					$sub=findThis($path.'/'.$file,$find);
					if(isset($sub)){
						echo $sub.PHP_EOL;
					}
				}else{
					$ext=substr(strtolower($file),-3);
					if($ext=='php'){
						$filesource=file_get_contents($path.'/'.$file);
						$pos = strpos($filesource, $find);
						if ($pos === false) {
							continue;
						} else {
							echo "The string '$find' was found in the file '$path/$file and exists at position $pos<br />";
						}
					}else{
						continue;
					}
				}
				$i++;
			}
		}
		closedir($handle);
	}
	$return = ob_get_contents();
	ob_end_clean();

	return $return;
}
?>


Create a new paste based on this one


Comments: