0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.149.254.229


Current Path : /var/www/html/convocation/
Upload File :
Current File : /var/www/html/convocation/pgResponse_old.php

<?php
	require_once("links/footer.php");
	require_once("links/header.php");
?>
<div class="page-container" style='margin-top:111px;'>
	<!-- BEGIN CONTENT -->
	<div class="page-content-wrapper">
		<div class="page-content">
<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: 0");

// following files need to be included
require_once("./lib/config_paytm.php");
require_once("./lib/encdec_paytm.php");
include("/var/www/config.php");




$paytmChecksum = "";
$paramList = array();
    
$isValidChecksum = "FALSE";

	$servername = SERVERNAME;
	$username = USERNAME;
	$password = PASSWORD;
    $dbname = "logisys3_rcu";
    
$conn = new mysqli($servername, $username, $password, $dbname);

$paramList = $_POST;

$paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : ""; //Sent by Paytm pg
//Verify all parameters received from Paytm pg to your application. Like MID received from paytm pg is same as your application?s MID, TXN_AMOUNT and ORDER_ID are same as what was sent by you to Paytm PG for initiating transaction etc.
$isValidChecksum = verifychecksum_e($paramList, 'RLbGzBidiez7Gj8G', $paytmChecksum); //will return TRUE or FALSE string.
//echo $isValidChecksum;

if($isValidChecksum == "TRUE") 
{
		$status = $_POST["STATUS"];
		//$status = 'success';
		//$productinfo = $_POST["ORDERID"];
		$txnid = $_POST["TXNID"];

		$orderid = $_POST["ORDERID"];
		$productinfo = $_POST["MERC_UNQ_REF"];


		$MID = $_POST["MID"];
		$CHECKSUMHASH = $_POST["CHECKSUMHASH"];
		//echo $productinfo;
		//$productinfo = '103E3050155';
		$MID = 'RaniCh03072461120906';
		$requestParamList = array();
		$responseParamList = array();
		
		//$requestParamList = array("MID" => "{$MID}" , "ORDERID" => "{$productinfo}");  
		$requestParamList = array("MID" => "{$MID}" , "ORDERID" => "{$orderid}", "MERC_UNQ_REF" => "{$productinfo}");
		
		$checkSum = getChecksumFromArray($requestParamList,'RLbGzBidiez7Gj8G');
		$requestParamList['CHECKSUMHASH'] = urlencode($checkSum);

		$data_string = "JsonData=".json_encode($requestParamList);
		
		$update = "update dctran set  FPAYREMARKS='{$data_string}',
		FPAYSTATUS='{$status}',FPAYDATE=now(),FTRANID='{$txnid}' 
		where FAPPNO='{$productinfo}'";
		$result=$conn->query($update); 
		$ch = curl_init();                    // initiate curl
		//$url = "https://pguat.paytm.com/oltp/HANDLER_INTERNAL/getTxnStatus?"; // where you want to post data
		$url = "https://secure.paytm.in/oltp/HANDLER_INTERNAL/getTxnStatus?"; // where you want to post data
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
		curl_setopt($ch, CURLOPT_URL,$url);
		curl_setopt($ch, CURLOPT_POST, true);  // tell curl you want to post something
		curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string); // define what you want to post
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the output in string format
		$headers = array();
		$headers[] = 'Content-Type: application/json';
		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
		$output = curl_exec($ch); // execute
		$info = curl_getinfo($ch);

		$data = json_decode($output, true);
		//echo $data;
	
	//echo "<b>Checksum matched and following are the transaction details:</b>" . "<br/>";
	if ($data["STATUS"] == "TXN_SUCCESS") 
	{
		$status = $data["STATUS"];
		//$productinfo = $data["ORDERID"];
		$txnid = $data["TXNID"];
		$MID = $data["MID"];
		$ORDERID = $data["ORDERID"];
		$productinfo = $data["MERC_UNQ_REF"];
		$amount = $data['TXNAMOUNT'];
		$CHECKSUMHASH = $data["CHECKSUMHASH"];

		$txnid = $data['TXNID'];
		$firstname = 'Paytm';
		$status = 'success';

		$update = "update dctran set  FPAYREMARKS='{$data_string}',
		FPAYSTATUS='{$status}',FPAYDATE=now(),FTRANID='{$txnid}' 
		where FAPPNO='{$productinfo}'";
		$result=$conn->query($update);
		
			echo " <div class='col-xs-9 center-block' style='float:none;margi:0 auto;'>  <h1 style='color:green;'>Thank You. Your payment status is ". $status ."</h1>";
				echo "<h2>Your Transaction ID for this transaction is ".$txnid.".</h2>";
				echo "<h3>We have received a payment of Rs. " . $amount  ."</h3>";
				$html='<button class="btn blue" onclick=\'CMS.PrintNETBANKCertifcatepaytm("'.$productinfo.'");\' type="button"><i class="fa fa-download"></i> Print Acknowledgement</button>';
				$html.='</div> ';
				echo $html; 
			
		//}
	}
	else 
	{
		echo "<b>Transaction status is failure</b>" . "<br/>";
	}

	/* if (isset($_POST) && count($_POST)>0 )
	{ 
		foreach($_POST as $paramName => $paramValue) {
				echo "<br/>" . $paramName . " = " . $paramValue;
		}
	}
	 */
}
/* else 
{
	echo "<b>Checksum mismatched.</b>";
	//Process transaction as suspicious.
} */

?>
</div>
		<?php require_once("links/footer.php");?> 
	</div>
</div>
</br>
</body>
</html>