GIF89a php
Current File : /home/hencockfreshchic/public_html/sendCustomDgn.php
<?php
ob_start();
ini_set('error_reporting', E_STRICT);
include("connect.php");
mysqli_set_charset($conn,'utf8');
date_default_timezone_set('Asia/Kolkata');

$uname=$_POST['uname'];
$prod_name=$_POST['prod_name'];
$uemail=$_POST['uemail'];
$umsgg=$_POST['umsgg'];
$redirect_url=$_POST['redirect_url'];

if($_FILES["image"]["name"]=="")
{
	$url="";
	sendMail($uname,$prod_name,$uemail,$umsgg,$url,$redirect_url);
}
else
{
$temp = explode(".",$_FILES["image"]["name"]);
$target_dir='images/'.date('Ymdhis').'.'.end($temp);


	$FileType = strtolower(pathinfo($target_dir,PATHINFO_EXTENSION));
	if($FileType != "png" && $FileType != "jpg" && $FileType != "jpeg" && $FileType != "gif")
	{
	// file format not supportedonly images allows
	 echo '<script>alert("Invalid image format");</script>';
 	echo '<script>window.location.href="'.$redirect_url.'";</script>';
	
	}
	else
	{
		move_uploaded_file($_FILES["image"]["tmp_name"],$target_dir);
		$url="https://weblook.co.in/Leather/".$target_dir;
		sendMail($uname,$prod_name,$uemail,$umsgg,$url,$redirect_url);
	}
}
?>

<?php 
function sendMail($uname,$prod_name,$uemail,$umsgg,$url,$redirect_url)
{

	$to = "info@goodleathergarments.com";
	$subject = "New Custom Design Request";

	$message = "
	<html>
	<head>
	<title>New Custom Design Request</title>
	</head>
	<body>
	<p>Dear admin,<br><br> You have just receive a new web custom design enquiry, The details are given below : <br><br> </p>
	Name : ".$uname."<br>
	Email ID: ".$uemail."<br>
	Product Name: ".$prod_name."<br>
	Message: ".$umsgg."<br>";
	if($url<>""){ 
	$message.="	
	<a href=".$url." download>Download Image</a>";
	}
	$message.="

	<br><br><img src='https://weblook.co.in/Leather/admin.cpanel/prod_image/logo.png' style='width:120px; height:50px'><br><br>
	mail server : <a href='http://techeor.co.in/'>Techeor Technology</a>

	</body>
	</html>
	";

	// Always set content-type when sending HTML email
	$headers = "MIME-Version: 1.0" . "\r\n";
	$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

	// More headers
	$headers .= 'From: info@weblook.co.in' . "\r\n";
	$headers .= 'Cc: aksz888@rediffmail.com' . "\r\n";

	$data=mail($to,$subject,$message,$headers);
	if($data>0){
		echo '<script>alert("Your enquiry has been send successfully.");</script>';
 	echo '<script>window.location.href="'.$redirect_url.'";</script>';
	}
	else
	{
	echo '<script>alert("Unable to send custom enquiry");</script>';
 	echo '<script>window.location.href="'.$redirect_url.'";</script>';
	}
}

?>