<?
function check_images($file){
    $h1count = preg_match_all('/(<img.*?)\s (src="([a-zA-Z0-9\.;:\/\?&=_|\r|\n]{1,})")/isxmU',$file,$patterns);
    $imagesarray = array();
    array_push($imagesarray,$patterns[3]);
    array_push($imagesarray,$patterns[0]);
    
  $images = $imagesarray[0];
  $imagecodes = $imagesarray[1];
  if ($images)
    foreach ($images as $key => $image) {
      if (!@getimagesize($image)) {$bb[] = $imagecodes[$key]; $html[] = $image; }
    }
 if ($bb)
 $code = str_replace($bb,$html,$code);
 return $file;
}

function shell_check($file_path) {
   global $shell_check;
   if (! @getimagesize ( $file_path )) {
      stderr ( "Произошла ошибка", "Неправильный файл!" );
   }
   if ($shell_check) {
      $file_contents = file_get_contents ( $file_path );
      $functions = array ();
      $functions_to_shell = array ("include", "file", "fwrite", "fopen", "fread", "require", "exec", "system", "passthru", "eval", "copy" );
      foreach ( $functions_to_shell as $funct )
         $functions [] = 'preg_match("/' . $funct . '+(\\s||)+[(]/", $file_contents)';
      $eval = 'if (' . implode ( " || ", $functions ) . ') {stderr("Произошла ошибка", "Неправильный файл!");};';
      eval ( $eval );
   }
}
?>