Jump to content

bobinindia

Members
  • Posts

    122
  • Joined

  • Last visited

    Never

Everything posted by bobinindia

  1. This may seem stupid but is 'desc' a column name in your table? Just in case!! $row["desc"];
  2. I am using mail(). It is sending the messages as far as I can see but hotmail and google don't receive them even in junk. What could it be? <?php mail($_POST['email'], 'Registration Confirmation', $body, 'From: register@somewhere.com'); ?>
  3. The script is a bit long as it does some other stuff. $filename = 'upload'; $description = 'description'; if (isset($_FILES['upload']) ) { if (!empty($_POST['description'])) { $d = "'" . escape_data($_POST['description']) . "'"; } else { $d = 'NULL'; } //Add the record to the database $query = "INSERT INTO uploads (file_name, file_size, file_type, description) VALUES ('{$_FILES['upload']['name']}', '{$_FILES['upload']['size']}', '{$_FILES['upload']['type']}', $d)"; $result = mysql_query ($query); if ($result) { $upload_id = mysql_insert_id(); if (move_uploaded_file($_FILES['upload']['tmp_name'], "../../externals/uploads/$upload_id")) { $picid = "../../externals/uploads/$upload_id".".jpeg"; define ("WIDTH", "600"); define ("HEIGHT", "600"); $img_name = $pic_id; function make_thumb($img_name,$filename,$new_w,$new_h) { $src_img=imagecreatefromjpeg($img_name); $old_x=imageSX($src_img); $old_y=imageSY($src_img); $ratio1=$old_x/$new_w; $ratio2=$old_y/$new_h; if($ratio1 > $ratio2) { $thumb_w=$new_w; $thumb_h=$old_y/$ratio1; } else { $thumb_h=$new_h; $thumb_w=$old_x/$ratio2; } $dst_img=imageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); imagejpeg($dst_img,$filename); imagedestroy($dst_img); imagedestroy($src_img); } $thumb_name="resized/".$upload_id.".jpeg"; $filename = $thumb_name; $thumb=make_thumb("../../externals/uploads/$upload_id",$thumb_name,WIDTH,HEIGHT); copy($thumb_name, "ImageEditor/edit/$upload_id".".jpeg"); copy($thumb_name, "ImageEditor/original/$upload_id".".jpeg"); copy($thumb_name, "ImageEditor/active/$upload_id".".jpeg"); ob_end_clean(); $picname = $upload_id.".jpeg"; header ("Location: ImageEditor/index.php?imageName=$picname"); } else { echo '<p><font color="red">File number could not be moved.</font></p>'; $query = "DELETE FROM uploads WHERE upload_id = $upload_id"; $result = mysql_query($query); //Add more error reporting if needed. } } else { //I the query did not run ok echo '<p><font color="red">Your submission could not be completed due to system error. Ooops.</font></p>'; //Print the query and invoke the mysql_error() function to debug. } } // end of Isset
  4. My php.ini is set to 32M. Why might my uploads be failing when they are more than about 200k?
  5. You must still be logged in. you need to log out and when doing that unset $_SESSION['password']; GOOD LUCK
  6. Thanks Barand! Why didn't I try that?? Am I not seeing the problem solved button
  7. ORDER BY rating; ASC or DESC as you need. If I understood the question
  8. Make the paragraph a link. Did I understand your problem?
  9. Is it possible to convert jpeg to png?
  10. png with taking the corners off with ImageMagick is where i am at now. putting an image onto a flat round surface is my clients need.(for KeeB) Any more help most welcome.
  11. More likely to be working with jpegs as customers willl upload their own family pictures. Any chance with ImageMagick?
  12. I am trying to crop an image that has been uploaded. Ideally I could crop it as a perfect circle. Is this possible with php?
  13. On the page where you are giving permission put: <?php session_start(); //NOTHING AT ALL CAN GO BEFORE session_start(); //if logged in successfully $_SESSION['password'] = 'potatotheimaginarypassword'; ?> That is the same as setting the $password variable which is not needed in this case. Every page needing password protection. NOTHING AT ALL CAN GO BEFORE THIS: <?php session_start(); if ($_SESSION['password'] == 'potatotheimaginarypassword') {//user is logged in // Show the contents of the protected pageπ } else { // user is not logged in, send them to index.php header("location: index.php"); exit; } ?>
  14. On the page that has authorised your guest put: session_start(); $_SESSION['password'] = 'somedifficultword'; //Now it is set. You must put session_start() at the top of every page. On the pages that need to be verified put: session_start(); if ($_SESSION['password'] == 'somedifficultword'){ //ok. Load page }else{ exit; } //not authorised Good Luck
  15. I would set a $_SESSION['password'] that must be met before any of the password protected pages can be opened. if ($_SESSION['password'] == $password) {//ok show page! }else{ exit;} Something along those lines 1
  16. Can you be a little clearer about your problem?
  17. Solved the array problem with foreach($_FILES['images']['tmp_name'] as $thisImage) { if(!empty($thisImage)) { $size=getimagesize($thisImage); // do whatever you want to do with $size } } in case anyone was interested
  18. This is the bad line of code $size=getimagesize($_FILES['images']['tmp_name']); if that helps
  19. Update it to the code below mysql_query("UPDATE resume SET file = '".$target_path."' WHERE email='".$_POST[email]."'"); mail("mike@worldgymaustralia.com","New Application at your website", "Please go to your website to see the application", 'From:you@youremail.com'); Good luck
  20. I have the same script running locally and on a remote server the remote is giving me these two messages Warning: getimagesize(Array) [function.getimagesize]: failed to open stream: No such file or directory in Warning: filesize() [function.filesize]: stat failed for Array in Locally it is fine and actually both servers complete the script. Why the warning? remote and local: php 5.2.5 Help much appreciated
  21. yes i think the upload wasn't clean Thanks
  22. You will want to make sure you contol the sizes of the images The code below converts the images into three different sizes as defined by the DEFINE. Use them as you need. Modify the code as per your own database etc. Hope it is useful define ("MAX_SIZE", "5000"); define ("WIDTH", "75"); define ("HEIGHT", "50"); define ("BWIDTH", "150"); define ("BHEIGHT", "100"); define ("FWIDTH", "600"); define ("FHEIGHT", "400"); function make_thumb($img_name,$filename,$new_w,$new_h) { $ext = getExtension($img_name); if(!strcmp("jpg", $ext) || !strcmp("jpeg",$ext)) $src_img=imagecreatefromjpeg($img_name); if(!strcmp("png",$ext)) $src_img=imagecreatefrompng($img_name); $old_x=imageSX($src_img); $old_y=imageSY($src_img); $ratio1=$old_x/$new_w; $ratio2=$old_y/$new_h; if($ratio1 > $ratio2) { $thumb_w=$new_w; $thumb_h=$old_y/$ratio1; } else { $thumb_h=$new_h; $thumb_w=$old_x/$ratio2; } $dst_img=imageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if(!strcmp("png",$ext)) imagepng($dst_img,$filename); else imagejpeg($dst_img,$filename); imagedestroy($dst_img); imagedestroy($src_img); } //end function make_thumb function getExtension($str) { $i = strrpos($str, "."); if (!$i) { return "";} $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } //end getExtension func $errors=0; if(isset($_POST['Submit'])) { while(list($key,$value) = each($_FILES[images][name])) { if(!empty($value)){ // this will check if any blank field is entered $filename = $value; { $filename = stripslashes($_FILES[images][name]); $extension = getExtension($value); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { echo '<h2>Invalid extension</h2>'; $errors=1; } else { $size=getimagesize($_FILES['images']['tmp_name']); $sizekb=filesize($_FILES['images']['tmp_name']); if ($sizekb > MAX_SIZE*1024) { echo '<h2>Over the file size limit<h2/>'; $errors=1; } $image_name=microtime(1).'.'.$extension; $newname="images/".$image_name; $newbname="images/".$image_name; $newfname="images/".$image_name; $copied = copy($_FILES[images][tmp_name][$key], $newname); if (!$copied) { echo '<h2>Not copied</h2>'; $errors=1; } else{ $thumb_name='thumbs/thumb_'.$image_name; $thumb=make_thumb($newname,$thumb_name,WIDTH,HEIGHT); $bthumb_name='thumbs/bthumb_'.$image_name; $bthumb=make_thumb($newbname, $bthumb_name,BWIDTH,BHEIGHT); $fthumb_name='thumbs/fthumb_'.$image_name; $fthumb=make_thumb($newfname, $fthumb_name,FWIDTH,FHEIGHT); if($password == $pcheckrow['Pass']){ $insertimagepath = mysql_query("INSERT INTO imageid (id, imagepath, thumbpath, thumbpathB, thumbpathF, userid) VALUES ('','$newname', '$thumb_name', '$bthumb_name', '$fthumb_name','$userid');"); } else { echo "Sorry incorrect password"; } }} }}}} I haven't weeded out what you don't need. Good Luck
  23. Unfortunately I have been playing with my error messages so until i find a way to restore the defaults i can't find it it was line 2936 of functions.php. Something wrong with the code. expecting *** variable. Something like that.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.