|
Server : LiteSpeed System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : outerorb ( 1091) PHP Version : 8.1.34 Disable Function : mail Directory : /home2/outerorb/zapnixinc.com/ | |
|
Path: /home2/outerorb/zapnixinc.com/contact_form_old.php
Size: 4.87 KB
Permissions: 0644
<?php
include_once("include/main.inc.php");
$admin_res = getAdminDetails();
date_default_timezone_set('Asia/Kolkata');
$enq_date = date('Y-m-d H:i:s');
$referer = $_SERVER['HTTP_REFERER'];
$ip=$_SERVER['REMOTE_ADDR'];
if (isset($_POST['career_submit'])){
// reCAPTCHA validation
$secretKey = "6LfIqp8rAAAAANYLo642doFVm-2pAtbyqbCT7N4z"; // Replace with your secret key
$responseKey = $_POST['g-recaptcha-response'];
// If reCAPTCHA is not checked
if (empty($responseKey)) {
$resp = [
'message_response' => 'Please click on the reCAPTCHA box.',
'status' => false
];
echo json_encode($resp);
exit;
}
// Validate reCAPTCHA with cURL
$url = "https://www.google.com/recaptcha/api/siteverify";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'secret' => $secretKey,
'response' => $responseKey,
'remoteip' => $ip
]);
$response = curl_exec($ch);
curl_close($ch);
// Decode the response
$responseData = json_decode($response);
if (!$responseData->success) {
$resp = [
'message_response' => 'reCAPTCHA verification failed. Please try again.',
'status' => false
];
echo json_encode($resp);
exit;
}
$fname = !empty($_POST['fname'])?$_POST['fname']:'';
$lname = !empty($_POST['lname'])?$_POST['lname']:'';
$mobile = (!empty($_POST['mobile']))?$_POST['mobile']:'';
$code = (!empty($_POST['code']))?$_POST['code']:'';
$email = (!empty($_POST['email']))?$_POST['email']:'';
$company = (!empty($_POST['company']))?$_POST['company']:'';
$country = (!empty($_POST['Country']))?$_POST['Country']:'';
$title = (!empty($_POST['message']))?$_POST['message']:'';
$sql_ens="insert into tbl_enquiry set en_name = '$fname . ' ' . $lname',enquiry_for='$code',en_address='$title', en_mobile='$mobile',en_email='$email',en_comment='$company',en_country='$country',en_url='$referer',en_ip='$ip',en_date='$enq_date'";
$qry=mysqli_query($GLOBALS['dbconn'],$sql_ens);
$subject = utf8_encode('New Lead from '.site_url);
$htmlContent = '<table border="0" width="100%">
<tbody>
<tr>
<td colspan="2">
<strong>Dear Admin</strong></td>
</tr>
<tr>
<td colspan="2">
Enquiry Received with following info :</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td width="26%">
<strong>Post URL : </strong></td>
<td>
<span style="margin-top: 15px;">' . $referer . '</span></td>
</tr>
<tr>
<td width="26%">
<strong>Name : </strong></td>
<td>
<span style="margin-top: 15px;">' . $fname .' '.$lname. '</span></td>
</tr>
<tr>
<td width="26%">
<strong>Email : </strong></td>
<td>
<span style="margin-top: 15px;">' . $email . '</span></td>
</tr>
<tr>
<td width="26%">
<strong>Contact No : </strong></td>
<td>
<span style="margin-top: 15px;">'.'+'.$code . '-' . $mobile . '</span></td>
</tr>
<tr>
<td>
<strong>Company : </strong></td>
<td>
<span style="margin-top: 15px;">' . $company . '</span></td>
</tr>
<tr>
<td>
<strong>Country : </strong></td>
<td>
<span style="margin-top: 15px;">' . $country . '</span></td>
</tr>
<tr>
<td>
<strong>Message : </strong></td>
<td>
<span style="margin-top: 15px;">' . $title . '</span></td>
</tr>
</tbody>
</table>';
$to = $admin_res['email'];
$to2 = $admin_res['cc'];
$to3 = 'vishnu.kumaroot@gmail.com';
if($to!='')
{
$mailStatus = smtp_mailer($to,$email,$name,$subject,$htmlContent);
}
if($to2!='')
{
$mailStatus = smtp_mailer($to2,$email,$name,$subject,$htmlContent);
}
$mailStatus = smtp_mailer($to3,$email,$fname,$subject,$htmlContent);
if($qry == "1" && $mailStatus == "Sent")
{
$resp = [
'message_response' => 'Thank you for your enquiry. Our team will contact you soon.',
'status' => true
];
echo json_encode($resp);
exit;
}
else{
$resp = [
'message_response' => 'Something Went Wrong!',
'status' => false
];
echo json_encode($resp);
exit;
}
}
?>