ob_start();
ob_clean();
session_start();
include "dilg/cnt/join.php";
date_default_timezone_set("Asia/Kolkata");
extract($_REQUEST);
$Product_id=$_GET['pid'];
//fetch product details
$sel_product=mysql_query("select * from common_news where status='1' and id='".$Product_id."'");
$fetch_product = mysql_fetch_array($sel_product);
$prow_id = $fetch_product['id'];
$title = $fetch_product['title'];
$Category_id = $fetch_product['category_id'];
$Brand_id = $fetch_product['scategory_id'];
//fetch category name
$get_category = mysql_query("select * from subcategory where id='".$Category_id."'");
$fetch_category = mysql_fetch_array($get_category);
$category_name = $fetch_category['category_name'];
//fetch subcategory name
$get_subcategory = mysql_query("select * from subcategory where id='".$Brand_id."'");
$fetch_subcategory = mysql_fetch_array($get_subcategory);
$subcategory_name = $fetch_subcategory['category_name'];
//addslashes
$name=addslashes($name);
$message=addslashes($message);
//form signup starts
if(isset($_POST['submit']))
{
if(empty($_SESSION['letters_code'] ) || strcasecmp($_SESSION['letters_code'], $_POST['letters_code']) != 0)
{
$captachaError = 'Captcha verification does not match!!!';
}
if (empty($_POST["name"]))
{
$cpersonError = "Contact Person is required";
}
if (empty($_POST["mobile"]))
{
$mobileError = "Mobile No. is required";
}
if (empty($_POST["email"]))
{
$emailErr = "Email is required";
}
if (empty($_POST["message"]))
{
$messageError = "Message is required";
}
if(empty($captachaError) && empty($mobileError) && empty($cpersonError) && empty($emailErr) && empty($messageError))
{
$insert_enquiry_data = mysql_query("insert into enquiry set type='Product', name='".$name."', email='".$email."', mobile = '".$mobile."', category_id='".$Category_id."', scategory_id='".$Brand_id."', product_id='".$prow_id."', message='".$message."', created_datetime = NOW()");
//echo "insert into enquiry values ('', '$name', '$email', '$mobile', '$message', '$Date','')";
$mobile_msg = ucfirst($name).','.$mobile.','.$email.','.substr($message,0,105);
function sms($mobile, $sms_text)
{
$url = "http://speedsms.123coimbatore.com/api.php?username=123cbe&password=663527&to=".$mobile."&from=WEBCBE&message=".urlencode($sms_text);
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$contents = curl_exec($ch);
if (curl_errno($ch)) {
echo curl_error($ch);
echo "\n
";
$contents = '';
} else {
curl_close($ch);
}
if (!is_string($contents) || !strlen($contents)) {
echo "Failed to get contents.";
$contents = '';
}
return true;
}
$reciever_mobile_no='';
//$smssender = sms($reciever_mobile_no, $mobile_msg);
$messages= '
|
| |
'.$title.' Enquiry From '.$name.' |
| |
Name |
'.$name.' |
| |
Email id |
'.$email.' |
| |
Mobile Number |
'.$mobile.' |
| |
Message |
'.$message.' |
| |
Warm Regards, |
|
| |
Arrow Associates |
|
|
';
$subject="".$title." Enquiry Details From ".$name;
$to="support@123coimbatore.com";
// Additional headers
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'Sender: ' . "\r\n";
$headers .= 'From: '.$name.' ' . "\r\n";
$headers .= 'Reply-To: '.$name.' <'.$email.'>' . "\r\n";
$res1=mail($to , $subject, $messages, $headers, '-fnoreply@arrowassociatecbe.com');
if($res1)
{
$signup_msg="Your Details Are Mailed Successfully. We will get back to you soon!";
echo "";
}
else
{
$error_msg = 'Unable to send your Enquiry, Try once again!';
//header('location:product-enquiry.php?error_msg='.$error_msg);
}
}
else
{
$error_msg = 'Required Fields are Missing!';
//header('location:product-enquiry.php?error_msg='.$error_msg);
}
}
//echo $messages;
function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
Arrow Associate | Product Enquiry