Current File : /var/www/html/common-popup-form.php |
<?php
ob_start();
if (isset($_POST["txtsend"])){
// echo "Isset";
if (isset($_POST['g-recaptcha-response'])) {
$secret_key = '6LeqLRwmAAAAAJvBd_AdTWSL43fJ_lENUX2AScEq';
$url = 'https://www.google.com/recaptcha/api/siteverify?secret='.$secret_key.'&response='.$_POST['g-recaptcha-response'];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
curl_close($curl);
$response = json_decode($data);
// echo "Isset1";
if ($response != null){
// echo "Notnull";
// echo $_POST['txtPageName'];
$message = "Dear Admin, Enquiry Message from Vertex Power - ".$_POST['txtPageName']." \r\n";
$message .= "--------------------------------------------------------------------------------\r\n";
$message .= "Name : ".$_POST['txtName']."\r\n";
$message .= "Company Name : ".$_POST['textCompanyname']."\r\n";
$message .= "Phone Number: ".$_POST['txtPhone']."\r\n";
$message .= "Email: ".$_POST['txtEmail']."\r\n";
$message .= "Location: ".$_POST['txtlocation']."\r\n";
$message .= "Products Interested: ".$_POST['txtProductInterest']."\r\n";
$message .= "Application: ".$_POST['txtApplication']."\r\n";
$message .= "Product Rating: ".$_POST['txtProductRating']."\r\n";
$message .= "Quantity: ".$_POST['txtQuantity']."\r\n";
$message .= "For: ".$_POST['txtForuse']."\r\n";
$message .= "Message: ".$_POST['txtMessage']."\r\n";
$message .= "--------------------------------------------------------------------------------\r\n";
date_default_timezone_set('Asia/Kolkata');
$to = "enquiry@vertexpower.co.in, digitifyuads@gmail.com";
$from = "enquiry@vertexpower.co.in";
// $to = "sales@vertexpower.co.in";
// $from = "sales@vertexpower.co.in";
$subject = "Vertex Power - https://www.vertexpower.co.in/ - ".date("d F Y");
$headers = "From: Vertex Power Website <noreply@vertexpower.co.in>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type:text/plain;charset=UTF-8" . "\r\n";
if(mail($to, $subject, $message, $headers)== true){
echo "<script type='text/javascript'> alert('Thank you for sending your details, we will get back to you soon.');</script>";
header('Location:'.$_POST['txtPageName']);
exit(0);
}else{
echo "<script type='text/javascript'> alert('Something went wrong please try again.');</script>";
header('Location:'.$_POST['txtPageName']);
exit(0);
}
} else {
echo "<script> alert('ReCaptcha failed!!');</script>";
header('Location:'.$_POST['txtPageName']);
exit(0);
}
}
}
ob_end_flush();
?>