alert('Invalid Verification Code'); history.back();");
}
}
$applicant_name = urlencode($_POST['applicant_name']);
$mobile_number = urlencode($_POST['mobile_number']);
$email_id = urlencode($_POST['email_id']);
$form_name = urlencode($_POST['form_name']);
$state = $_POST['state'];
if (isset($_POST['form_id'])&& $_POST['form_id'] == 'water_testing') {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$sql1="
INSERT INTO fssai (
form_name,
applicant_name,
mobile_number,
email_id,
business_name,
business_address,
state,
district,
pincode,
licence_type,
form_created_on
)
VALUES (
'".$_POST["form_name"]."',
'".$_POST["applicant_name"]."',
'".$_POST["mobile_number"]."',
'".$_POST["email_id"]."',
'".$_POST["business_name"]."',
'".$_POST["office_address"]."',
'".$_POST["office_state"]."',
'".$_POST["office_district"]."',
'".$_POST["pincode"]."',
'".$_POST["check_licence"]."',
'".$date."'
)";
if (!$result = $conn->query($sql1)) {
die('There was an error running the query [' . $conn->error . ']');
} else {
$formType = $_POST["check_licence"].' Water Testing Form';
$_SESSION["form_id"] = $conn->insert_id;
$ch = curl_init('https://crm2.techlounge.co.in/api/registration-form-submission.php?formId='.$_SESSION["form_id"].'&vendor=TTG&business=FSSAI&website='.$crm_website.'&amount=ENQUIRY&status=Unpaid&name='.$applicant_name.'&mobile='.$mobile_number.'&email='.$email_id.'&formName='.urlencode($formType).'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$api_url = "https://demolounge.in/admin/api_insert_sales.php";
$data = [
'site_url' => 'https://'.strtolower($crm_website),
'form_name' => $form_name,
'business_area' => 'FSSAI',
'cus_full_name' => $applicant_name,
'cus_mobile' => $mobile_number,
'cus_email' => $email_id,
'state' => $_POST["office_state"],
'order_id' => '-',
'payment_amount' => 0
];
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/x-www-form-urlencoded']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if (curl_errno($ch)) {
throw new Exception('cURL Error: ' . curl_error($ch));
}
curl_close($ch);
// Mailer
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = 'efoodlicence.com';
$mail->SMTPAuth = true;
$mail->Username = 'no-reply@efoodlicence.com';
$mail->Password = 'freeDOM@611#';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom("no-reply@efoodlicence.com", "EFOODLICENCE");
$mail->addAddress("".$_POST["email_id"]."");
$mail->addBcc("udyogaadhaaronline.org@gmail.com");
$mail->isHTML(true);
$mail->Subject = "Your ".$_POST["form_name"]." Submitted Successfully";
$mail->Body = "
Dear ".$_POST["applicant_name"].",
Thank you for submitting your request for ".$_POST["form_name"]." on our website.
This mail is an acknowledgement of successful submission of your application, on our website. This mail does not confirm the
payment status against the submitted application.
Regards,
Team Processing,
For Queries: info@efoodlicence.com
";
$mail->send();
$mail->ClearAllRecipients();
$mail->addAddress("no-reply@efoodlicence.com");
$mail->isHTML(true);
$mail->Subject = "New ".$_POST["form_name"]." Submitted";
$mail->Body = "
APPLICANT NAME: ".$_POST["applicant_name"]."
MOBILE NUMBER: ".$_POST['mobile_number']."
EMAIL ID: ".$_POST['email_id']."
";
$mail->send();
}
catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
echo "";
echo "";
function generate($length = 7) {
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
$token = '';
while(strlen($token) < $length) {
$token .= $chars[mt_rand(0, strlen($chars) - 1)];
}
return 'ORDER_' . $token;
}
}
?>