extract($_REQUEST); ob_start(); ob_clean(); session_start(); include 'dilg/cnt/join.php'; date_default_timezone_set("Asia/Kolkata"); $Date=date('Y-m-d h:i:s',time()); //for avoiding single quotes conflict Starts $name=addslashes($name); $message=addslashes($message); //for avoiding single quotes conflict End //image upload starts $filename = $_FILES['image']['name']; $filesize = $_FILES['image']['size']; $ext = strtolower(substr(strrchr($filename, "."), 1)); $image_size = ($filesize / 1024); if($filename != '') { if($ext == 'jpg' or $ext == 'jpeg' or $ext == 'gif' or $ext == 'png') { $path =date('d-m-Y_h-i-s').'_'.str_replace(" ","_",$filename); $image_path = "uploads/testimonial-images/".$path; $up_path = $path; copy($_FILES['image']['tmp_name'],$image_path); chmod($image_path,0777); $max_width = '250'; $max_height = '250'; if($ext=='jpg') $ext = 'jpeg'; $t = 'imagecreatefrom'.$ext; $t = str_replace('.','',$t); $img = $t($image_path); $orig_width = imagesx( $img ); $orig_height = imagesy( $img ); $width = $orig_width; $height = $orig_height; # taller if ($height > $max_height) { $width = ($max_height / $height) * $width; $height = $max_height; } # wider if ($width > $max_width) { $height = ($max_width / $width) * $height; $width = $max_width; } $image_p = imagecreatetruecolor($width, $height); imagecopyresampled($image_p, $img, 0, 0, 0, 0, $width, $height, $orig_width, $orig_height); $pathToImages = 'uploads/testimonial-images/'; $fname = $max_width.'-'.$path; imagejpeg( $image_p, "{$pathToImages}{$fname}" ); } } //image upload starts if(isset($_POST['submit'])) { if(empty($_SESSION['letters_code'] ) || strcasecmp($_SESSION['letters_code'], $_POST['letters_code']) != 0) { $errors = "\n The Captcha Verification does not match!!!"; } if(empty($errors)) { //echo "insert into feedback set name='$name', mobile='$mobile', email='$email', message='$message', created_datetime='$Date' "; $ins_values =mysql_query("insert into feedback set name='$name', mobile='$mobile', email='$email', image='$up_path', message='$message', created_datetime='$Date' "); if($ins_values) { $msg="Thank you for your time and interest to providing us feedback!!!"; header('location:post-testimonial.php?msg='.$msg); } else { $msg="could not able to add try once again!!"; } } } //echo $messages ; ?>