D:\host\scoreman.in\upstate2025closed\pay\res.php
<?php include('Crypto.php')?>
<?php
include "../config.php";
include "../functions.php";
error_reporting(0);
$workingKey='6CBC74F643120DAD52528C1150F03D91'; //Working Key should be provided here. tnrsa
$encResponse=$_POST["encResp"]; //This is the response sent by the CCAvenue Server
$rcvdString=decrypt($encResponse,$workingKey); //Crypto Decryption used as per the specified working key.
$order_status="";
$order_id="";
$tracking_id="";
$payment_mode="";
$trans_date="";
$decryptValues=explode('&', $rcvdString);
$dataSize=sizeof($decryptValues);
echo "<center>";
for($i = 0; $i < $dataSize; $i++)
{
$information=explode('=',$decryptValues[$i]);
if($i==3) $order_status=$information[1];
if($i==0) $order_id=$information[1];
if($i==1) $tracking_id=$information[1];
if($i==5) $payment_mode=$information[1];
if($i==40) $trans_date=$information[1];
}
if($order_status==="Success" || $order_status==="Shipped" )
{
$order_status="Success";
$databaseQuery = 'UPDATE applications SET order_id="'.$order_id.'",tracking_id="'.$tracking_id.'", order_status="'.$order_status.'",payment_mode="'.$payment_mode.'", trans_date="'.$trans_date.'", amt="'.$resob->order_amt.'", capamt="'.$resob->order_capt_amt.'", ccavenuefee="'.$resob->order_fee_perc_value.'" , paytax="'.$resob->order_tax.'" where appno="'.$order_id.'"';
mysqli_query($con,$databaseQuery) or mysqli_error();
echo "<br>Thank you. Your transaction is successful. You will receive Payment Confirmation & Application Form by Email Shortly.";
sendform($order_id);
//echo '<br><a href="applicationpdf.php?appno='.$order_id.'">Click Here to Print / Download Annual Registration Form</a>';
$databaseQuery = 'SELECT appno,sname,email,hashcode FROM applications where (appno= "'.$order_id.'")';
$result = mysqli_query($con,$databaseQuery) or die('Query failed: ' . mysqli_error());
if($result)
{
$row = mysqli_fetch_array($result);
$appno=$row["appno"];
$key=$row["hashcode"];
echo '<a target="_blank" href="https://tamilnaduskate.com/tndistricts2025/application.php?appno='.$appno.'&k='.$key.'">Click Here to Print / Download Entry Form</a>';
}
}
else if($order_status==="Aborted")
{
echo "<br>Payment Aborted.";
$databaseQuery = 'UPDATE applications SET order_id="'.$order_id.'",tracking_id="'.$tracking_id.'", order_status="'.$order_status.'",payment_mode="'.$payment_mode.'", trans_date="'.$trans_date.'" where appno="'.$order_id.'"';
//echo $databaseQuery;
mysqli_query($con,$databaseQuery) or mysqli_error();
}
else if($order_status==="Failure")
{
echo "<br>Sorry.The transaction has been declined.";
$databaseQuery = 'UPDATE applications SET order_id="'.$order_id.'",tracking_id="'.$tracking_id.'", order_status="'.$order_status.'",payment_mode="'.$payment_mode.'", trans_date="'.$trans_date.'" where appno="'.$order_id.'"';
//echo $databaseQuery;
mysqli_query($con,$databaseQuery) or mysqli_error();
}
else
{
echo "<br>Security Error. Illegal access detected";
}
echo "<br><br>";
?>
<table>
<tr><td>Event </td><td>:TNDT2025</td></tr>
<tr><td>Application No./ Order ID</td><td>:<?=$order_id?></td></tr>
<tr><td>Payment Status</td><td>:<?=$order_status?></td></tr>
<tr><td>Tracking No</td><td>:<?=$tracking_id?></td></tr>
<tr><td>Payment Mode</td><td>:<?=$payment_mode?></td></tr>
<tr><td>Tr. Date</td><td>:<?=$trans_date ?></td></tr>
</table>
<?php
/* echo "<table cellspacing=4 cellpadding=4>";
for($i = 0; $i < $dataSize; $i++)
{
$information=explode('=',$decryptValues[$i]);
echo '<tr><td>'.$information[0].'</td><td>'.$information[1].'</td></tr>';
}
echo "</table><br>";*/
echo "</center>";
?>