

Wrzucam pelny kod:
<?php /*READ COOKIE*/ $user = $HTTP_COOKIE_VARS["user"]; /* GET FORM DATA */ $pictitle = $_POST['title']; $picdescription = $_POST['description']; $piccategory = $_POST['category']; $filename = $_FILES['picture']['name']; $filesize = $_FILES['picture']['size']; $filetype = $_FILES['picture']['type']; /* OTHER VARIABLES */ $error = ""; $positive = ""; $thumbnailx = 150; $thumbnaily = 113; $thumbname = "mini".$filename.""; $thumburl = "thumbnails/".$thumbname.""; /* DB QUARIES */ include ("inc/sqlConnect.php"); $query1 = "SELECT artist_id FROM artist WHERE artist_email = '$user'"; $userid = "".$data['artist_id'].""; $query = "INSERT INTO pictures (picure_id, picture_filename, picture_thumbname, picture_categoryid, picture_artistid, picture_title, picture_decription, picture_uploadtime) VALUES ('','$filename', '$thumbname', '$piccategory', '$userid', '$pictitle', '$picdescription', now())"; /* DATA VALIDIATION */ if ($pictitle == "") { $error = "Enter the title please !<br/><a href='java script:java script:history.go(-1)'>Back</a>"; } elseif ($_FILES['picture']['type']!= "image/pjpeg") { $error = "Your file has to be saved as JPG file !<br/><a href='java script:java script:history.go(-1)'>Back</a>"; $error = "This file already exists in our database<br/><a href='java script:java script:history.go(-1)'>Back</a>"; } else { if ($imgwidth > 800 || $imgheight >600) { $error = "Your picture shouldn`t be bigger than 800x600 px !<br/><a href='java script:java script:history.go(-1)'>Back</a>"; } else { resizePicture("pictures/".$filename."", $thumbnailx, $thumbnaily, $thumburl); $positive = "Your picture has been succesfully uploaded"; }; }; /* CREATE THUMBNAIL -FUNCTION */ function resizePicture($picture, $expwidth, $expheight, $thumbpath) { $xscale=$width/$expwidth; $yscale=$height/$expheight; if ($yscale>$xscale){ } else { } $new_picture = imagecreatetruecolor($new_width, $new_height); $temporary_picture = imagecreatefromjpeg ($picture); imagecopyresampled($new_picture, $temporary_picture, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagejpeg($new_picture, "".$thumbpath.""); }; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <? ?> </body> </html>