"; $dir_handle = @opendir($path) or die("Unable to open $path"); $total_infection_count = 0; @mkdir('./iframe_cleaner_backup/'); echo "
    "; list_dir($dir_handle,$path,$filename="",$content_pattern); echo "
"; echo "Total infection count: $total_infection_count
"; function list_dir($dir_handle,$path,$filename_pattern,$content_pattern){ while(false !== ($file = readdir($dir_handle))){ $dir =$path.'/'.$file; if(is_dir($dir) && $file != '.' && $file !='..' && $file!='iframe_cleaner_backup'){ $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){ $infection_count = 0; $handle = @fopen($dir, "r+"); if($handle){ while(!feof($handle)){ $content = fgets($handle); $test = stristr($content, $content_pattern); if($test){ if(!$infection_count){ copy($dir, './iframe_cleaner_backup/'.str_replace('/','$',$path).'$'.$file); } $infection_count++; } } fclose($handle); if($infection_count){ echo "
  • $webpath$dir Found ".$infection_count." infection(s)
  • "; global $total_infection_count; $total_infection_count += $infection_count; } } //} } } closedir($dir_handle); } ?>