Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by int20 ( 18 years ago )
<?php
	session_start();
	
	if(!include($_SERVER['DOCUMENT_ROOT'] . "/req/config.inc.php"))
	{
		echo "Abnormal program termination: can't see configuration files. Stopped.";
		exit();
	}	
	
	include($_SERVER['DOCUMENT_ROOT'] . "/req/thumbnail2.php");	
	
	echo $photosPath . "<br>";
	echo $thumbsPath . "<br>";
	echo $originalPhotoPath . "<br>";
	
	
	// 1. &ETH;“&ETH;&micro;&ETH;&frac12;&ETH;&micro;&Ntilde;€&ETH;&cedil;&Ntilde;€&Ntilde;ƒ&ETH;&micro;&ETH;&frac14; &ETH;&frac12;&ETH;&frac34;&ETH;&sup2;&ETH;&frac34;&ETH;&micro; &ETH;&cedil;&ETH;&frac14;&Ntilde; &Ntilde;„&ETH;&deg;&ETH;&sup1;&ETH;&raquo;&ETH;&deg;.
	
	echo "&ETH;&iexcl;&ETH;&sup3;&ETH;&micro;&ETH;&frac12;&ETH;&micro;&Ntilde;€&ETH;&cedil;&Ntilde;€&ETH;&frac34;&ETH;&sup2;&ETH;&deg;&ETH;&frac12;&ETH;&frac12;&ETH;&frac34;&ETH;&micro; &ETH;&cedil;&ETH;&frac14;&Ntilde; &Ntilde;„&ETH;&deg;&ETH;&sup1;&ETH;&raquo;&ETH;&deg;: ";
	echo strtolower($photo_filename = $_POST['id'] . "-" . mt_rand(100000,999999).getFileType($_FILES['userfile']['name']));
	

	
	// 2. &ETH;š&ETH;&raquo;&ETH;&deg;&ETH;&acute;&Ntilde;‘&ETH;&frac14; &ETH;&frac34;&Ntilde;€&ETH;&cedil;&ETH;&sup3;&ETH;&cedil;&ETH;&frac12;&ETH;&deg;&ETH;&raquo; &ETH;&sup2; originals.
	if (move_uploaded_file($_FILES['userfile']['tmp_name'], $originalPhotoPath . "/" . $photo_filename)) 
	{
		echo "<br>Original: <a href='http://dev.estspb.ru/photos/originals/" . $photo_filename . "'>here</a><br>";
	} else {
	    print "Possible file upload attack!  Here's some debugging info:n";
	    print "Possible file upload attack!  &ETH;”&ETH;&frac34;&ETH;&iquest;&ETH;&frac34;&ETH;&raquo;&ETH;&frac12;&ETH;&cedil;&Ntilde;‚&ETH;&micro;&ETH;&raquo;&Ntilde;Œ&ETH;&frac12;&ETH;&deg;&Ntilde; &ETH;&frac34;&Ntilde;‚&ETH;&raquo;&ETH;&deg;&ETH;&acute;&ETH;&frac34;&Ntilde;‡&ETH;&frac12;&ETH;&deg;&Ntilde; &ETH;&cedil;&ETH;&frac12;&Ntilde;„&ETH;&frac34;&Ntilde;€&ETH;&frac14;&ETH;&deg;&Ntilde;†&ETH;&cedil;&Ntilde;:n";
	    print_r($_FILES);
	}	
	
	// 3. &ETH;Ÿ&ETH;&cedil;&Ntilde;ˆ&ETH;&micro;&ETH;&frac14; thumbnail 150x150 &ETH;&sup2; thumbs
	$options = array(
	    'width'  => 150,
	    'height' => 150,
	    'type'   => IMAGETYPE_JPEG,
	);
	Thumbnail::output($originalPhotoPath."/".$photo_filename, $thumbsPath."/".$photo_filename, $options);
	echo "<br>Thumnail: <a href='http://dev.estspb.ru/photos/thumbs/".$photo_filename."'>here</a>";
	
	// 4. &ETH;Ÿ&ETH;&cedil;&Ntilde;ˆ&ETH;&micro;&ETH;&frac14; 450&Ntilde;…450
	$options = array(
	    'width'  => 450,
	    'height' => 450,
	    'type'   => IMAGETYPE_JPEG,
	    'method'  => THUMBNAIL_METHOD_SCALE_MIN,
	);
	Thumbnail::output($originalPhotoPath."/".$photo_filename, $photosPath."/".$photo_filename, $options);
	echo "<br>Photo: <a href='http://dev.estspb.ru/photos/".$photo_filename."'>here</a>";
	
	
	$DB->query("INSERT INTO photos (filename, pid) VALUES (?, ?)", $photo_filename, $_POST['id']);
	header("Location: /cars/car_photo.php?id=".$_POST['id']);
	exit();
		
		

	
function getFileType($yourfile){

 $filedes = array(
                ".gif",
                ".jpg",
                ".png",
                ".JPG",
                ".JPEG",
                ".GIF",
                ".PNG"
                );

 $fileext = array(".gif",".jpg",".png", ".JPG", ".JPEG", ".GIF", ".PNG");

 $ext = strrchr($yourfile,'.');
 if (in_array($ext,$fileext)) {
        $ext2 = array_search($ext, $fileext);
        $filetype = $filedes[$ext2];
 } else {
        $filetype = "Wrong File Format! Please, use JPG Files. :)";
 }

 return $filetype;
 }


 
?>

 

Revise this Paste

Your Name: Code Language: