Server IP : 103.53.40.154 / Your IP : 3.129.63.252 Web Server : Apache System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : ppcad7no ( 715) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home2/ppcad7no/mansacdcc.com/../indiatourbus.com/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php include_once('admin/config.php'); if ($_SERVER["REQUEST_METHOD"] === "POST") { if (isset($_POST['submit-booking'])) { // Capture form data $tour_name = $_POST['tour_name']; $name = $_POST['name']; $phone = $_POST['phone']; $address = $_POST['address']; $email = $_POST['email']; $date = $_POST['date']; $person = $_POST['accomodation']; $pickup = $_POST['pickup_points']; $price = $_POST['price']; date_default_timezone_set('Asia/Kolkata'); $currentDate = date('Y-m-d'); // Insert order details into database $sqli = "INSERT INTO `tbl_order`( `ord_amount`, `ord_ord_name`, `ord_person_name`, `ord_email`, `ord_mobile`, `ord_person_no`, `ord_pickup_point`, `ord_doj`, `ord_status`, `ord_adrs`, `ord_date`) VALUES ( '$price', '$tour_name', '$name', '$email', '$phone', '$person', '$pickup', '$date', '$address', 'Not Paid', '$currentDate')"; $result = mysqli_query($db, $sqli) or die("Query unsuccessful"); if($result){ $hostName = 'India Tour Bus'; $msgmail="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' /> <title>TradeKeyIndia.com-Largest B2B Portal In India</title> </head> <body> <table align='center' cellSpacing='0' cellPadding='0' width='87%' border='1' style='border:1px solid #e61938'> <tbody> <tr> <td vAlign='top' style='background-color:#e61938; padding:10px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:16px; color:#ffffff; text-align:center; font-weight:bold;' colspan='3' >Enquiry From $hostName</td> </tr> <tr> <td width='30%' vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#003366; background-color:#F9E2DD;padding:10px;' ><strong>Package</strong> </td> <td vAlign='top' width='70%' style='font-family:Verdana, Arial, Helvetica, sans-serif;padding:10px;'>$tour_name</td> </tr> <tr> <td width='30%' vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#003366; background-color:#F9E2DD;padding:10px;' ><strong>Cost</strong> </td> <td vAlign='top' width='70%' style='font-family:Verdana, Arial, Helvetica, sans-serif;padding:10px;'>$price</td> </tr> <tr> <td width='30%' vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#003366; background-color:#F9E2DD;padding:10px;' ><strong>Name</strong> </td> <td vAlign='top' width='70%' style='font-family:Verdana, Arial, Helvetica, sans-serif;padding:10px;'>$name</td> </tr> <tr> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#003366; background-color:#F9E2DD;padding:10px;' ><strong>Mobile</strong> </td> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif;padding:10px;'>$phone</td> </tr> <tr> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#003366; background-color:#F9E2DD;padding:10px;' ><strong>Email-Id</strong> </td> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif;padding:10px;'>$email</td> </tr> <tr> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#003366; background-color:#F9E2DD;padding:10px;' ><strong>Address</strong> </td> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif;padding:10px;'>$address</td> </tr> <tr> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#003366; background-color:#F9E2DD;padding:10px;' ><strong>Date of journey</strong> </td> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif;padding:10px;'>".date('d M Y',strtotime($date))."</td> </tr> <tr> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#003366; background-color:#F9E2DD;padding:10px;' ><strong>No. of Person</strong> </td> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif;padding:10px;'>$person</td> </tr> <tr> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#003366; background-color:#F9E2DD;padding:10px;' ><strong>Pickup Points</strong> </td> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif;padding:10px;'>$pickup</td> </tr> <tr> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; color:#003366; background-color:#F9E2DD;padding:10px;' ><strong>Current Status</strong> </td> <td vAlign='top' style='font-family:Verdana, Arial, Helvetica, sans-serif;padding:10px;'>In Process</td> </tr> </tbody> </table> </body> </html>"; $senderName = $name; $senderEmail = $email; $toEmail = "info@indiatourbus.com"; $subject = "Booking Details From $hostName"; $from="$senderEmail"; $Headers1 = "From: $senderName <$senderEmail>\r\n"; $Headers1 .= "Reply-To: $senderEmail\r\n"; $Headers1 .= "X-Mailer: PHP/" . phpversion() . "\r\n"; $Headers1 .= "X-Priority: 3\r\n"; $Headers1 .= "MIME-Version: 1.0\r\n"; $Headers1 .= "Content-Type: text/html; charset=iso-8859-1\r\n"; @mail("$toEmail", "$subject", "$msgmail","$Headers1","-fenquiry@tradekeyindia.com"); $toEmail."<br>"; ///////////////****** Mailer to client end here **********************////////////// $toEmail =$email; $subject = "Booking confirmation on IndiaTourBus"; $from="info@indiatourbus.com"; $Headers1 = "From: info@indiatourbus.com<$from>\n"; $Headers1 .= "Reply-To: info@indiatourbus.com\r\n"; $Headers1 .= "X-Mailer: PHP/" . phpversion() . "\r\n"; $Headers1 .= "X-Priority: 3\r\n"; $Headers1 .= "MIME-Version: 1.0\r\n"; $Headers1 .= "Content-Type: text/html; charset=iso-8859-1\r\n"; @mail("$toEmail", "$subject", "$msgmail","$Headers1","-fenquiry@tradekeyindia.com"); $toEmail."<br>"; if($enquiry_email){ @mail($mail_to_admin,$sub_admin,$mail_admin_body,$headers_admin); } } // Get the order ID $ordID = mysqli_insert_id($db); $payrate = $price * 100; // Prepare data for PhonePe API call $merchantKey = 'aab2cd96-6fd3-4e67-8bc6-c7ed57366411'; $transactionId = uniqid('TXL', true); $arrayVar = [ "merchantId" => "INDIATONLINE", "merchantTransactionId" => $transactionId, "merchantUserId" => $ordID, "amount" => $payrate, "redirectUrl" => "https://www.indiatourbus.com/check.php?payment_request_id=$ordID&transaction_id=$transactionId&ord_payment_gateway=PhonePe", // "redirectUrl" => "https://www.indiatourbus.com/thanks.php?payment_request_id=$ordID&payment_status=Credit", "redirectMode" => "POST", "callbackUrl" => "https://www.indiatourbus.com/webhook.php", "mobileNumber" => $phone, "paymentInstrument" => ["type" => "PAY_PAGE"], ]; $jsonPayload = json_encode($arrayVar); $base64EncodedPayload = base64_encode($jsonPayload); $Checksum = hash('sha256', $base64EncodedPayload . "/pg/v1/pay" . $merchantKey) . '###1'; // Make API call to PhonePe $url = "https://api.phonepe.com/apis/hermes/pg/v1/pay"; $headers = array( "Content-Type: application/json", "X-VERIFY: " . $Checksum, "accept: application/json" ); $data = json_encode(array( "request" => $base64EncodedPayload )); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { // Handle Curl error header("Location: https://www.indiatourbus.com/failure.php"); exit; } curl_close($ch); // Process response from PhonePe $responseData = json_decode($response, true); // echo "Response from PhonePe API: <br>"; // print_r($responseData);exit; if (isset($responseData['success']) && $responseData['success'] == 1) { // If success, redirect to payment URL and update order status $paymentUrl = $responseData['data']['instrumentResponse']['redirectInfo']['url']; $iti = 'ITI' . $ordID; $sql = "UPDATE tbl_order SET ord_payment_gateway = 'PhonePe', ord_pnr_no='$iti', ord_status='Not Paid' WHERE ord_id = '$ordID'"; $res = mysqli_query($db, $sql); header("Location: $paymentUrl"); exit; } else { // If payment request creation failed, update order status as 'Failed' $sql = "UPDATE tbl_order SET ord_payment_gateway='PhonePe', ord_status='Failed' WHERE ord_id='$ordID'"; $res = mysqli_query($db, $sql); header("Location: https://www.indiatourbus.com/failure.php"); exit; } } } ?>