Просмотр файла file/loads/pr.php

Размер файла: 904B
<?php
 @$file = $_GET["img"];
 @$heightfile = $_GET["h"];
 @$weightfile = $_GET["w"];
   if(preg_match("[http]",$file)) exit("Sorry");
  if(preg_match("[\.\.]",$file)) exit("Sorry");
  if(preg_match("[%]",$file)) exit("Sorry");
  if($heightfile > 500) exit('Sorry');
if($weightfile > 500) exit('Sorry');
  if(preg_match("[\.png]",$file)) {
 $old = imagecreatefrompng("$file"); 
 } elseif(preg_match("[\.gif]",$file)) {
  $old = imagecreatefromgif("$file"); 
  } elseif(preg_match("[\.jpg]",$file) or preg_match("[\.JPG]",$file)) {
  $old = imagecreatefromjpeg("$file"); 
  }
 $weight = imageSX($old); 
 $height = imageSY($old);
 if($heightfile) {
 $wn = $weightfile;
 $hn = $heightfile;
 } else {
$wn = 35;
$hn = 35;
}
$new = imageCreate($wn, $hn);
imageCopyResized($new, $old, 0, 0, 0, 0, $wn, $hn, $weight, $height);
Header("Content-type: image/jpeg");
imagejpeg($new); 
?>