" "){ //make sure this directory is writable! $path_thumbs = "userPhotos/"; //the new width of the resized image, in pixels. $img_thumb_width = 160; // $extlimit = "yes"; //Limit allowed extensions? (no for all extensions allowed) //List of allowed extensions if extlimit = yes $limitedext = array(".gif",".jpg",".png",".jpeg",".JPG"); //the image -> variables $file_type = $_FILES['ProfilePicture']['type']; $file_name = $_FILES['ProfilePicture']['name']; $file_size = $_FILES['ProfilePicture']['size']; $file_tmp = $_FILES['ProfilePicture']['tmp_name']; //check the file's extension $ext = strrchr($file_name,'.'); $ext = strtolower($ext); //uh-oh! the file extension is not allowed! if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { echo "Wrong file extension.
--back"; exit(); } //so, whats the file's extension? $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; //create a random file name //$rand_name = md5(time()); ///$rand_name = time(); $rand_name = "journal_".$_SESSION["sessionUserID"]."_".time(); //the new width variable $ThumbWidth = $img_thumb_width; //keep image type if($file_size){ if($file_type == "image/pjpeg" || $file_type == "image/jpeg"){ $new_img = imagecreatefromjpeg($file_tmp); }elseif($file_type == "image/x-png" || $file_type == "image/png"){ $new_img = imagecreatefrompng($file_tmp); }elseif($file_type == "image/gif"){ $new_img = imagecreatefromgif($file_tmp); } //list the width and height and keep the height ratio. list($width, $height) = getimagesize($file_tmp); //calculate the image ratio $imgratio=$width/$height; if ($imgratio>1){ $newwidth = $ThumbWidth; $newheight = $ThumbWidth/$imgratio; }else{ $newheight = $ThumbWidth; $newwidth = $ThumbWidth*$imgratio; } //make sure the image is big enough to resize if (($newwidth > $width) || ($newheight > $height) ){ $newwidth = $width; $newheight = $height; } //function for resize image. if (function_exists(imagecreatetruecolor)){ $resized_img = imagecreatetruecolor($newwidth,$newheight); }else{ die("Error: Please make sure you have GD library ver 2+"); } //the resizing is going on here! imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); //finally, save the image ImageJpeg ($resized_img,"$path_thumbs/$rand_name.$file_ext"); $pictureName= $rand_name.".".$file_ext ; ImageDestroy ($resized_img); ImageDestroy ($new_img); } $SQL = "UPDATE journal SET Photo = '$pictureName' WHERE User_ID = '" . $_SESSION["sessionUserID"] . "' and ID = '" . $_REQUEST["ID"] . "' "; $result = mysql_query($SQL) or die(mysql_error()); } $The_Text = ereg_replace("'","´",$_REQUEST["The_Text"]); $Title = ereg_replace("'","´",$_REQUEST["Title"]); $SQL = "UPDATE journal SET Title = '$Title', The_Text = '$The_Text' WHERE User_ID = '" . $_SESSION["sessionUserID"] . "' and ID = '" . $_REQUEST["ID"] . "' "; $result = mysql_query($SQL) or die(mysql_error()); $reqID = $_REQUEST["ID"]; header("Location: myJournal.php?ID=$reqID "); exit ; } if($_REQUEST['theAction'] == "delete"){ $SQL = "DELETE FROM journal WHERE User_ID = '" . $_SESSION["sessionUserID"] . "' and ID = '" . $_REQUEST["ID"] . "' "; $result = mysql_query($SQL) or die(mysql_error()); $reqID = $_REQUEST["ID"]; header("Location: myJournal.php"); exit ; } //GET JOURNAL ENTRY INFO $SelectStr = "SELECT * FROM journal where User_ID = '" . $_SESSION["sessionUserID"] . "' AND ID = '" . $_REQUEST["ID"] . "'"; $result = mysql_query($SelectStr) or die(mysql_error()); if($myrow=MySQL_fetch_array($result)){ $TITLE = $myrow["Title"]; $THETEXT = $myrow["The_Text"]; $photo = $myrow["Photo"]; } ?> Yada Home | Journal
yada home
my fridge
" />

  Edit Journal Entry
Title:
Blog Entry:
Upload Photo: ""){ ?>     
 
cancel
my journal entries


" class="movieReviewLinks">edit  |  " class="movieReviewLinks">delete


 
 
free profile