|
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/zapnix.co/ | |
|
Path: /home2/outerorb/zapnix.co/category_form_code.php
Size: 4.41 KB
Permissions: 0644
<?php
include_once("include/main.inc.php");
$admin_res = getAdminDetails();
// Set the timezone to Eastern Time (ET)
date_default_timezone_set('America/New_York');
// // Print current time for the set timezone
// echo date('Y-m-d H:i:s');
$enq_date = date('Y-m-d H:i:s');
$referer = $_SERVER['HTTP_REFERER'];
$ip = $_SERVER['REMOTE_ADDR'];
if (isset($_POST['cat_submit'])) {
$secretKey = SECRET_KEY;
$responseKey = $_POST['g-recaptcha-response'];
if (empty($responseKey)) {
$resp = [
'message_response' => 'Please click on the reCAPTCHA box.',
'status' => false
];
echo json_encode($resp);
exit;
}
$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);
$responseData = json_decode($response);
if (!$responseData->success) {
$resp = [
'message_response' => 'reCAPTCHA verification failed. Please try again.',
'status' => false
];
echo json_encode($resp);
exit;
}
$name = !empty($_POST['name']) ? $_POST['name'] : '';
$email = !empty($_POST['email']) ? $_POST['email'] : '';
$mobile = (!empty($_POST['mobile'])) ? $_POST['mobile'] : '';
if ($name != '' && $email != '' && $mobile != '') {
$sql_ens = "INSERT INTO tbl_enquiry (en_name, en_email, en_mobile, en_url, en_date, en_ip) VALUES ('$name', '$email', '$mobile', '$referer', '$enq_date', '$ip')";
$qry = mysqli_query($GLOBALS['dbconn'], $sql_ens);
$subject = utf8_encode(COMPANY . ' - ' . 'Category Lead from ' . site_url);
//admin mail template
$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;">' . $name . '</span></td></tr>
<tr><td width="26%"><strong>Email Id:</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;">' . $mobile . '</span></td></tr>
</tbody>
</table>';
//user mail template
$UserContent = '<table border="0" width="100%">
<tbody>
<tr>
<td colspan="2">
<strong>Dear ' . $name . ',</strong>
</td>
</tr>
<tr>
<td colspan="2">
<p>Thank you for contacting Zapnix. We have received your inquiry and our team will get back to you soon.</p>
</td>
</tr>
<tr>
<td colspan="2">
<p>If you have any questions or need immediate assistance, feel free to reply to this email.</p>
</td>
</tr>
<tr>
<td colspan="2">
<strong>Best regards,</strong><br>
<strong>Zapnix Team</strong><br>
<span>Contact us: support@zapnix.co</span>
</td>
</tr>
</tbody>
</table>';
$to = $admin_res['email'];
$to2 = $admin_res['cc'];
$to3 = 'vishnu.kumaroot@gmail.com';
if($to!='')
{
smtp_mailer($to, $email, $name, $subject, $htmlContent);
}
if($to2!='')
{
smtp_mailer($to2, $email, $name, $subject, $htmlContent);
}
if($email!='')
{
smtp_mailer($email, $email, $name, $subject, $UserContent);
}
smtp_mailer($to3, $email, $name, $subject, $htmlContent);
$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' => 'All fields are mandatory!',
'status' => false
];
echo json_encode($resp);
exit;
}
}
?>