ok
Direktori : /home2/selectio/www/subamangala/admin/ |
Current File : /home2/selectio/www/subamangala/admin/paymentsuccess.php |
<?php include "header.php"; ?> <?php if($_POST['code']=='PAYMENT_SUCCESS'){ /*$encryptedUrl = $_GET['code']; $encryptionKey = 'TTC'; $decryptedUrl = openssl_decrypt(urldecode($encryptedUrl), 'aes-256-cbc', $encryptionKey, 0, $encryptionKey);*/ $encryptionKey = 'TTC'; $decodedUrl = base64_decode(urldecode($_GET['code'])); $iv = substr($decodedUrl, 0, 16); $encryptedUrl = substr($decodedUrl, 16); $decryptedUrl = openssl_decrypt($encryptedUrl, 'aes-256-cbc', $encryptionKey, 0, $iv); $statement = $pdo->prepare("SELECT * FROM `tbl_bookings` WHERE id='".$decryptedUrl."'"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); if($totalData>0){ $tickets = $pdo->prepare("SELECT * FROM `tbl_tickets` WHERE booking_id='".$decryptedUrl."'"); $tickets->execute(); $tickets_query = $tickets->fetchAll(PDO::FETCH_ASSOC); $tickets_totalData = $tickets->rowCount(); if($tickets_totalData>0){ $passenger_name = $tickets_query[0]['name']; $passenger_seat_no = $tickets_query[0]['seat_no']; $gender_age = $tickets_query[0]['age']; } $pickup_city = $query[0]['from_city']; $drop_city = $query[0]['to_city']; $boarding_point = $query[0]['boarding_point']; $dropping_point = $query[0]['dropping_point']; $passenger_mobile_no = $query[0]['customer_mobile']; $trip_date = $query[0]['trip_date']; $pnr_number = $query[0]['pnr_number']; $booking_amount = $query[0]['booking_amount']; // Query Sections Here // Pickup City Name Here $statement_pickup_city = $pdo->prepare("SELECT * FROM tbl_cities WHERE id=".$pickup_city.""); error_log("SELECT * tbl_cities WHERE id=".$pickup_city.""); $statement_pickup_city->execute(); $pickup_city_results = $statement_pickup_city->fetchAll(PDO::FETCH_ASSOC); $pc_name = $pickup_city_results[0]['short_name']; // Drop City Name Here $statement_drop_city = $pdo->prepare("SELECT * FROM tbl_cities WHERE id=".$drop_city); $statement_drop_city->execute(); $drop_city_results = $statement_drop_city->fetchAll(PDO::FETCH_ASSOC); $dc_name = $drop_city_results[0]['short_name']; // Boarding Points Name Here $statement_boarding_point = $pdo->prepare("SELECT * FROM tbl_points WHERE id=".$boarding_point); $statement_boarding_point->execute(); $boarding_point_results = $statement_boarding_point->fetchAll(PDO::FETCH_ASSOC); $boarding_name = $boarding_point_results[0]['name']; $boarding_time = date('h:i A', strtotime($boarding_point_results[0]['time'])); // Dropping Points Name Here $statement_dropping_point = $pdo->prepare("SELECT * FROM tbl_points WHERE id=".$dropping_point); $statement_dropping_point->execute(); $dropping_point_results = $statement_dropping_point->fetchAll(PDO::FETCH_ASSOC); $dropping_name = $dropping_point_results[0]['name']; $dropping_time = date('h:i A', strtotime($dropping_point_results[0]['time'])); // Query Sections Here // Official Values Here $bookings_cities = $pc_name.'-'.$dc_name; $official_boarding_point = $boarding_point_results[0]['name'].'('.$boarding_time.')'; $official_dropping_point = $dropping_point_results[0]['name'].'('.$dropping_time.')'; $travel_date_and_time = date("d-m-Y", strtotime($trip_date)).'&'.$boarding_time; $customer_mobile_number = "91".$passenger_mobile_no; }else{ } // SMS - Starts Here $curl = curl_init(); // Booking SMS Starts Here $pnr = $pnr_number; $sender_id = "TNTCON"; $contact_no = "9487654079,%208870752528"; $mobile_no = urlencode($customer_mobile_number); // More Details Starts Here $pickup_details_drop_details = urlencode($bookings_cities); $boarding_points = urlencode($official_boarding_point); $dropping_points = urlencode($official_dropping_point); $travel_date_time = urlencode($travel_date_and_time); $fare = urlencode($booking_amount); $passenger_names = urlencode($passenger_name); $seat_no = urlencode($passenger_seat_no); $gender = urlencode($gender_age); $message = "THANK%20YOU%20for%20choosing%20TNTRANSCONNECT%20Your%20Ticket%20Details%20Ticket%20PNR%20No%3A%20".$pnr."%20Ticket%20BOOKING%3A%20".$pickup_details_drop_details."%20Boarding%20Point%3A%20".$boarding_points."%20Dropping%20Point%3A%20".$dropping_points."%20Travel%20Date%26Time%3A%20".$travel_date_time."%20Fare%3A%20".$fare."%20Passenger%20Name%3A%20".$passenger_names."%20Seat%20No%3A%20".$seat_no."%20Sex%3A%20".$gender."%20Contact%20No%3A%20".$contact_no."%20TNTCON"; $boooking_urls = "https://sms.nettyfish.com/api/v2/SendSMS?SenderId=".$sender_id."&Message=".$message."&MobileNumbers=".$mobile_no."&PrincipleEntityId=1701169339505563944&TemplateId=1707169408943586060&ApiKey=5NeNiAAN5lPtjPfVHfped35BEitgvJHg9HLgI74FOIY%3D&ClientId=7f09c168-0d74-4aa6-b804-7ada0d5b974a"; $booking_sms = "SenderId=".$sender_id."&Message=".$message."&MobileNumbers=".$mobile_no."&PrincipleEntityId=1701169339505563944&TemplateId=1707169408943586060&ApiKey=5NeNiAAN5lPtjPfVHfped35BEitgvJHg9HLgI74FOIY%3D&ClientId=7f09c168-0d74-4aa6-b804-7ada0d5b974a"; error_log($boooking_urls); curl_setopt_array($curl, array( CURLOPT_URL => $boooking_urls, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', )); $response = curl_exec($curl); curl_close($curl); // SMS - Endsss Here // Update Query Here $statement = $pdo->prepare("UPDATE `tbl_bookings` SET status=1,transaction_id=?,payment_type=? WHERE id=?"); $result = $statement->execute(array($_POST['transactionId'],'Completed',$decryptedUrl)); if($result){ $statement = $pdo->prepare("UPDATE `tbl_tickets` SET status=1 WHERE booking_id=?"); $result = $statement->execute(array($decryptedUrl)); } $payment_status = "Payment Success"; $booking_status = "Booking Completed"; $download = '<div class="submit-btn text-center"> <a class="btn" href="admin/ticket-download.php?id='.$decryptedUrl.'">Download Ticket</a> </div>'; /*echo 'Payment Received Successfully...<br>'; echo 'Booking id:'.$_POST['transactionId'].'<br>'; echo 'transactionId id:'.$_POST['merchantId'].'<br>'; echo 'providerReferenceId:'.$_POST['providerReferenceId'].'<br>'; echo 'param1:'.$_POST['merchantUserId'].'<br>';*/ }else{ /*echo 'Payment Received Failed<br>';*/ $payment_status = "Payment Failed"; $booking_status = "Booking Failed"; $download = '<div class="submit-btn text-center"> <a class="btn" href="index.php">Back to Home</a> </div>'; } ?> <main> <div class="container"> <section class="fly-next-area"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-8"> <div class="section-title text-center"> <h2 class="title"><?=$payment_status?></h2> </div> </div> </div> <div class="row fly-next-active justify-content-center"> <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 grid-item grid-sizer cat-two"> <div class="fly-next-item" style="box-shadow: rgba(14, 30, 37, 0.12) 0px 2px 4px 0px, rgba(14, 30, 37, 0.32) 0px 2px 16px 0px;"> <div class="row"> <center><h3><?=$booking_status?></h3></center> <div class="col-md-6"> </div> </div> <p> <?php /*if(isset($_POST)){ print_r($_POST); }*/ ?> </p> <?=$download?> <!--<div class="fly-next-content"> <a href="booking.php?pickup_city=6&drop_city=10&journey_date=<?=$today_date?>"> <h4 class="title">Coimbatore</h4> <span class="exchange-btn"><i class="flaticon-exchange-1"></i></span> <h4 class="title">Bangalore</h4> </a> </div>--> </div> </div> </div> </div> </section> </div> </main> <?php include "footer.php"; ?>