MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/imyrqtmy/public_html/vaticaplus/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/vaticaplus/payment-success.php
<?php
session_start();
include ("Admin/Includes/db.php");
$uid =  $_SESSION['userid'] ;
date_default_timezone_set('Asia/Kolkata');
 $cudate = date("Y-m-d") ;
 
 $itemid = $_SESSION['itemid'];
$itemqty = $_SESSION['itemqty'];
$itempri = $_SESSION['itempri'];
$csid = $_SESSION['comid'];

$lname = $_SESSION['lname'];
$address = $_SESSION['address'];
$state = $_SESSION['state'];
$city = $_SESSION['city'];

$address = $_SESSION['address'];
$state = $_SESSION['state'];
$city = $_SESSION['city'];

$daddress = $_SESSION['daddress'];
$dstate = $_SESSION['dstate'];
$dcity = $_SESSION['dcity'];

$ddate = $_SESSION['ddate'];
$dname = $_SESSION['dname'];
$dphone =$_SESSION['dphone'];
$landmark = $_SESSION['landmark'];
$pincode = $_SESSION['pincode'];
$discount = $_SESSION['discount'];
$msgonr = $_SESSION['msgonr'];
// print_r($_SESSION);

 $sqlu = "SELECT * FROM `tbl_order` ORDER BY id DESC";
    $sql_resu = mysqli_query($con, $sqlu) or die(mysqli_error($con));
     $sql_rowu = mysqli_fetch_array($sql_resu);

     if($sql_rowu['order_no'] == '')
     {
      $orderno ='1001';
     }
     else
     {
       $orderno = $sql_rowu['order_no'] + 1 ;
     }

// exit;
?>
<!DOCTYPE html>
<html>
<head>
<title>Instamojo Thank You - Tutsmake</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
</head>
<body class="">
	
	<br><br><br><br>
	<article class="bg-secondary mb-3">  
	<div class="card-body text-center">
	<h4 class="text-white">Thank you for payment<br></h4>
	<?php

		require_once('vendor/autoload.php');

        $API_KEY = "4a919500044332edebf4a2aaa1d8aec6";
        $AUTH_TOKEN = "b873a698482b092d48979847c5f9236f";
        $URL = "https://www.instamojo.com/api/1.1/";

		$api = new Instamojo\Instamojo($API_KEY, $AUTH_TOKEN,$URL);

		$payid = $_GET["payment_request_id"];

		try {
		$response = $api->paymentRequestStatus($payid);
		
// 		print_r($response);
		
		$payment_id = $response['payments'][0]['payment_id'];
		$fname = $response['payments'][0]['buyer_name'];
		$email = $response['payments'][0]['buyer_email'];
		$phone = $response['payments'][0]['buyer_phone'];
		$pay_status = $response['payments'][0]['status'];
		$amount = $response['payments'][0]['amount'];
		
		
// 		echo "<h5>Payment ID: " . $response['payments'][0]['payment_id'] . "</h5>" ;
// 		echo "<h5>Payment Name: " . $response['payments'][0]['buyer_name'] . "</h5>" ;
// 		echo "<h5>Payment Email: " . $response['payments'][0]['buyer_email'] . "</h5>" ;
// 		echo "<h5>Payment Mobile: " . $response['payments'][0]['buyer_phone'] . "</h5>" ;
// 		echo "<h5>Payment status: " . $response['payments'][0]['status'] . "</h5>" ;
// 		echo "<pre>";
		
	
        // You can get the 'salt' from Instamojo's developers page(make sure to log in first): https://www.instamojo.com/developers
        // Pass the 'salt' without <>

    if($pay_status == "Credit"){
        // Payment was successful, mark it as successful in your database.
        // You can acess payment_request_id, purpose etc here. 
        
        // $email=$_POST['email'];
                                  $html_message  =  '<h1>New Oreder Info.</h1>';
                                  
                                  $html_message  =  '<h1>BILLING DETAILS.</h1>';
                                  $html_message  .=   '<p>Name : '. $fname .' '. $lname .'</p>';
                                  $html_message  .=   '<p>Email :'.$email.'</p>';
                                  $html_message  .=   '<p>Mobile :'.$phone.'</p>';
                                   $html_message  .=  '<h1>RECEIVERS DETAILS.</h1>';
                                   $html_message  .=   '<p>Name : '. $dname .'</p>';
                                  $html_message  .=   '<p>Mobile :'.$dphone.'</p>';
                                  $html_message  .=   '<p>OrderNo :'.$orderno.'</p>';
                                  $html_message  .=   '<p>Price :'.$amount.'</p>';
 
                                 
          
                $to ="m.deepak.agarwal@gmail.com" ;
                
                // $to ="Sharma.ritik12@gmail.com" ;
                 $subject = "Oreder Details";
                 $header = "From:$email \r\n";
                 $header .= "MIME-Version: 1.0\r\n";
                 $header .= "Content-type: text/html\r\n";
                 
                 $retval = mail ($to,$subject,$html_message,$header);
        
        $csid = $_SERVER['REMOTE_ADDR'];
   $SQL = "INSERT INTO tbl_order set loginid='$uid',ucid='$csid',fname='$fname',lname='$lname',daddress='$daddress',dcity='$dcity',dstate='$dstate',address='$address',state='$state',city='$city',email='$email',phone='$phone',total_p='$amount',order_date='$cudate',payment_method='$radio',order_no='$orderno',pay_status='$pay_status',pay_id='$payment_id',msgonr='$msgonr',check_p='$check',deliver_date='$ddate',rname='$dname',rphone='$dphone',dlandmark='$landmark',dpincod='$pincode',discount='$discount'";
    
    
          if ($con->query($SQL) === TRUE) {

          	 $last_id = $con->insert_id;

          	$pro = "SELECT * FROM tbl_cart WHERE cid='$csid' and status='1'";
			$result=$con->query($pro);
			if($result->num_rows > 0)
			{

				  $SQLs = "INSERT INTO tbl_item set order_id='$last_id',pid='$itemid',qty='$itemqty',price='$itempri',goodies='$goodies'";
				$sql_res = mysqli_query($con, $SQLs) or die(mysqli_error($con));

			}
       
      $sqlc = "delete from tbl_cart  where cid='$csid'";
    $resultc = mysqli_query($con, $sqlc) or die(mysqli_error($con));
        
                  $_SESSION['flash_message'] = 'orderadd';
       
        
      echo "<script>;
                window.location.href='index.php';
                </script>";

	 }
    }
    else{
        // Payment was unsuccessful, mark it as failed in your database.
        // You can acess payment_request_id, purpose etc here.
    }


		}
		catch (Exception $e) {
		print('Error: ' . $e->getMessage());
		}
		
		
	?>
	<br>
	<!--<p><a class="btn btn-warning" target="_blank" href="https://www.tutsmake.com/"> Tutsmake.com  -->
	<!-- <i class="fa fa-window-restore "></i></a></p>-->
	</div>
	<br><br><br>
	</article>

</body>
</html>

MMCT - 2023