GIF89a php
Current File : /home/hencockfreshchic/public_html/thankyou.php
<?php
//session_start();
include("connect.php");
$payid = $_GET["payment_id"];
$pay_status=$_GET['payment_status'];
$pay_request_id=$_GET['payment_request_id'];

?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../favicon.ico">

    <title>Chandbook Depot Payments</title>

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  </head>

  <body>
    <div class="container">
   <?php
	  if($pay_status=="Failed"){
	  ?>
      <div class="page-header">
   
        <h1><a href="instamojo/index.php">Chandbook Depot Payments</a></h1>
        <p class="lead">Dear user your payment has been failed | Please try again to make a small amount donation</p>
     
          
      </div>

      <h3 style="color:#6da552">Try Again, Payment Failed!!</h3>
      <?php } else { ?>
       <div class="page-header">
   
        <h1><a href="instamojo/index.php">Chandbook Depot Payments</a></h1>
        <p class="lead">Thanks for a little donation to your society | Now you are member of this society</p>
     
          
      </div>

      <h3 style="color:#6da552">Thank You, Payment succus!!</h3>
      <?php } ?>
      
  

 <?php

include 'instamojo.php';

$api = new Instamojo\Instamojo('41810085bc5b3bfac412921e1fb26186', '655d56e94c2ecbfea53ea91628704fe0','https://test.instamojo.com/api/1.1/');


$mobb=$_COOKIE["mobb"];
$uid=$_COOKIE["uid"];
if($pay_status=="Failed"){
	$sql2="DELETE FROM `incoming_order` WHERE `order_id`='".$_COOKIE["orderid"]."'";
	$rs2=mysqli_query($conn,$sql2);
	if($rs2>0)
	{
			echo '<script>alert("Your payment is failed due to several reasons | Please try again "); window.location.href="payment.php";</script>';
	}
	else
	{
		echo '<script>alert("Server issue | Contact to developers"); window.location.href="payment.php";</script>';
	}
}
else
{
	// delete items from the cart
            $sqlDel="DELETE FROM `my_cart` WHERE `user_id`='".$_COOKIE["user_id"]."'";
            $rsDel=mysqli_query($conn,$sqlDel);
  $sql="UPDATE `incoming_order` SET `payment_id`='".$payid."',`payment_status`='".$pay_status."' WHERE `order_id`='".$_COOKIE["orderid"]."'";
	$rs=mysqli_query($conn,$sql);
	if($rs>0)
	{

		echo '<script>alert("You are successfully payout | Now please get your ID card"); window.location.href="order-complete_pay.php";</script>';
	}
	else
	{
		$sql2="DELETE FROM `incoming_order` WHERE `order_id`='".$_COOKIE["orderid"]."'";
    $rs2=mysqli_query($conn,$sql2);
		echo '<script>alert("Server issue | Contact to developers"); window.location.href="registration.php";</script>';
	}

}

try {
    $response = $api->paymentRequestStatus($payid);


    echo "<h4>Payment ID: " . $response['payments'][0]['payment_id'] . "</h4>" ;
    echo "<h4>Payment Name: " . $response['payments'][0]['buyer_name'] . "</h4>" ;
    echo "<h4>Payment Email: " . $response['payments'][0]['buyer_email'] . "</h4>" ;

  echo "<pre>";
  // print_r($response);
echo "</pre>";
    ?>


    <?php
}
catch (Exception $e) {
    print('Error: ' . $e->getMessage());
}



  ?>


      
    </div> <!-- /container -->


  </body>
</html>