alert('Invalid Verification Code'); history.back();");
// }
// }
use Razorpay\Api\Api;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
if(defined('PAYMENT_GATEWAY')) { //atom
$orderId ='order_'.(rand(10000000000,99999999999));
}else if(defined('PAYMENT_GATEWAY')){ //cashfree
include_once('./editable/submit-form.php');
function generate($length = 7) {
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
$token = '';
while(strlen($token) < $length) {
$token .= $chars[mt_rand(0, strlen($chars) - 1)];
}
return 'ORDER_' . $token;
$orderId = generate(13);
}
}else{
$orderId ='';
}
$crm_website = strtoupper($_SERVER['SERVER_NAME']);
$url1 = $_SERVER['SERVER_NAME'];
$webpath = pathinfo($url1, PATHINFO_FILENAME);
$website = strtoupper($webpath);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//uydam cantilation
if ((isset($_POST['form_name']))&&(isset($_POST['form_id']))&&($_POST['form_name']=="UDYAM Cancellation")&&($_POST['form_id']=="udyam_cancellation")){
$applicant_name = urlencode($_POST['applicant_name']);
$mobile_number = urlencode($_POST['mobile_number']);
$email_id = urlencode($_POST['email_id']);
$form_name = urlencode($_POST['form_name']);
//cancel reason togle
if(isset($_POST['cancel_reason_text'])){$cancelreason=$_POST['cancel_reason_text'];}else{$cancelreason=$_POST['cancel_reason'];}
$_SESSION['table_id'] = 'msme_form';
$payment_status = 'Unpaid';
// price of udaym canceletion
$product_price = 2700;
$sql = "INSERT INTO msme_form (
form_name,
applicant_name,
mobile_number,
email_id,
aadhaar_number,
udyam_number,
business_name,
total_amount,
payment_status,
terms_of_service,
cancel_reason,
order_id
) VALUES (
:form_name,
:applicant_name,
:mobile_number,
:email_id,
:aadhaar_number,
:udyam_number,
:business_name,
:total_amount,
:payment_status,
:terms_of_service,
:cancel_reason,
:order_id
)";
$result = $conn->prepare($sql);
$result->execute([
'form_name' => $_POST['form_name'],
'applicant_name' => $_POST['applicant_name'],
'mobile_number' => $_POST['mobile_number'],
'email_id' => $_POST['email_id'],
'aadhaar_number' => $_POST['aadhaar_number'],
'udyam_number' => $_POST['udyam_number'],
'business_name' => $_POST['business_name'],
'total_amount' => $product_price,
'payment_status' => $payment_status,
'terms_of_service' => 'Checked',
'cancel_reason' => $cancelreason,
'order_id' => $orderId
]);
if(!$result = $conn->prepare($sql)){
die('There was an error running the query [' . $conn->error . ']');
}
else
{
$_SESSION["formId"] = $conn->lastInsertId();
$ch = curl_init('https://crm2.techlounge.co.in/api/registration-form-submission.php?formId='.$_SESSION["formId"].'&vendor=TTG&business=MSME&website='.$crm_website.'&amount='.$product_price.'&status=Unpaid&name='.$applicant_name.'&mobile='.$mobile_number.'&email='.$email_id.'&formName='.$form_name.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$_SESSION["panel_form_id_2"] = $response;
$ch = curl_init('https://crm11.techlounge.co.in/api/registration-form-submission.php?formId='.$_SESSION["formId"].'&vendor=TTG&business=MSME&website='.$crm_website.'&amount='.$product_price.'&status=Unpaid&name='.$applicant_name.'&mobile='.$mobile_number.'&email='.$email_id.'&formName='.$form_name.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$_SESSION["panel_form_id_11"] = $response;
//Payment Gateway Redirection
if (defined('PAYMENT_GATEWAY') && $currentPaymentGateway == 'CASHFREE') {
include_once('./cashfree/request.php');
} else if (defined('PAYMENT_GATEWAY') && $currentPaymentGateway == 'ATOM') {
include_once('./atom/submit.php');
} else if (defined('PAYMENT_GATEWAY') && $currentPaymentGateway == 'PAYU') {
include_once('../payu-email/payu-submit.php');
}else if (defined('PAYMENT_GATEWAY') && $currentPaymentGateway == 'PAYKUN') {
include_once('../payu/payu-submit.php');
}else if (defined('PAYMENT_GATEWAY') && $currentPaymentGateway == 'RAZORPAY') {
include_once('../payu/payu-submit.php');
}
// Mailer
$host_name = $_SERVER['HTTP_HOST'];
$website_name = strtoupper($host_name);
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
// $mail->SMTPDebug = 2;
$mail->Host = $host_name;
$mail->SMTPAuth = true;
$mail->Username = 'order@'.$host_name.'';
$mail->Password = 'freeDOM@611#';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('order@'.$host_name.'', $website_name);
$mail->addAddress($_POST["email_id"]);
$mail->isHTML(true);
$mail->Subject = "New ".$_POST["form_name"]." Form Submitted";
$mail->Body = "
APPLICANT NAME: ".$_POST["applicant_name"]."
MOBILE NUMBER: ".$_POST['mobile_number']."
EMAIL ID: ".$_POST['email_id']."
BUSINESS NAME: ".$_POST["business_name"]."
AADHAAR NUMBER: ".$_POST["aadhaar_number"]."
UDYAM NUMBER: ".$_POST["udyam_number"]."
CANCELLATION REASON: ".$_POST['cancel_reason']."
TOTAL AMOUNT: ".$product_price."
";
$mail->send();
}
catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
include_once('./client-email.php');
//after submiting...
die();
}
?>