|
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/dev.outerorbittech.com/anant-engg/ | |
|
Path: /home2/outerorb/dev.outerorbittech.com/anant-engg/whatsapp_enq.php
Size: 4.26 KB
Permissions: 0644
<?php
include_once("include/main.inc.php");
date_default_timezone_set('Asia/Kolkata');
$date = date('Y-m-d H:i');
$admin_sql = mysqli_query($dbconn, "select * from admin_details");
$admin_res = mysqli_fetch_array($admin_sql);
$referer = $_SERVER['HTTP_REFERER'];
$ip = $_SERVER['REMOTE_ADDR'];
$whatsapp_no=$admin_res['whatsapp_no'];
if(isset($_POST['name'])){
$name = $_POST['name'];
$mobile = $_POST['mobile'];
$code = (!empty($_POST['code']))?$_POST['code']:'';
$countryNames = (!empty($_POST['countryName']))?$_POST['countryName']:'';
$countryName1= explode('(',$countryNames);
$countryName=$countryName1[0];
$code =$code!=''?$code:'91';
$countryName= $countryName!=''?$countryName:'India';
$mobileNumbers= '+'.$code.' - '.$mobile;
$email = 'enquiry@webpulseindia.com';
if($name != '' && $mobile != '' && $ip != '' ){
if(strlen($mobile) < '9' || strlen($mobile) > '12'){
$resp = [
'message_response' => 'Mobile Number must have 9-12 digits!!!',
'status' => false
];
echo json_encode($resp);
exit;
}
if (strpos($name, '#') !== false || strpos($name, '%') !== false || strpos($name, '@') !== false || strpos($name, '&') !== false || strpos($name, '~') !== false || strpos($name, 'https') !== false || strpos($name, 'http') !== false || strpos($name, 'www') !== false || strpos($name, '?') !== false) {
$resp = [
'message_response' => 'URL(s) and special characters are not allowed!',
'status' => false
];
echo json_encode($resp);
exit;
} else {
$save_enquiry = "insert into tbl_enquiry set en_name='$name', en_mobile='$mobile',en_comment='WhatsApp Enquiry', en_url='$referer',en_zcode='$code',en_country_name='$countryName', en_date='$date', en_ip='$ip'";
$result = $dbconn->query($save_enquiry);
// $to = $admin_res['email'];
// $to2 = $admin_res['cc'];
// $to3 = 'webpulseindia@gmail.com';
$to3 = 'vicky.wpsranchi@gmail.com';
// $headers = 'From: '.'Webpulseindia.com'.' enquiry@webpulseindia.com' . "\r\n" .
// 'Reply-To: '.$name.'<'.$email.'>' . "\r\n" .
// 'X-Mailer: PHP/' . phpversion();
$subject = utf8_encode('New Leads Via Whatsapp from '.site_url);
// $htmlContent = "
// Customer Details:
// Url: ".$referer."
// Name: ".$name."
// Mobile: ".$mobile;
$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>Contact No : </strong></td>
<td>
<span style="margin-top: 15px;">' . $mobileNumbers . '</span></td>
</tr>
<tr>
<td>
<strong>Country : </strong></td>
<td>
<span style="margin-top: 15px;">' . $countryName . '</span></td>
</tr>
</tbody>
</table>';
// @mail($to,$subject,$htmlContent,$headers);
// @mail($to2,$subject,$htmlContent,$headers);
// @mail($to3,$subject,$htmlContent,$headers);
if($to!='')
{
smtp_mailer($to, $email, $name, $subject, $htmlContent);
}
if($to2!='')
{
smtp_mailer($to2, $email, $name, $subject, $htmlContent);
}
smtp_mailer($to3, $email, $name, $subject, $htmlContent);
$resp = [
'message_response' => 'https://api.whatsapp.com/send?phone=91'.$whatsapp_no.'&text=Hello, I was on Your Website '.$referer.' and wanted to Enquire about your Services.',
'status' => true
];
echo json_encode($resp);
exit;
}
} else {
$resp = [
'message_response' => 'All the fields are mandatory!!!',
'status' => false
];
echo json_encode($resp);
exit;
}
}
?>