
<?php
session_start();



  
  $amn=$_POST['amount'];
  
      
 

?>
<html>
<head>
<title> </title>
</head>
<body>
<center>

<?php 
$ra=rand(10,1000000000);
include('link/databaseconnection.php');
 $mobile=$_POST['billing_tel'];
 $session=$_POST['session'];
 $tracking_id=$_POST['tid'];
 $order_id=$_POST['order_id'];
 $form_id=$_POST['form_id'];
 $sel="select * from payment_fees where billing_tel='$mobile' and order_status='Success' and session='$session' and form_id='$form_id' or order_id='$order_id' and order_status='Success' and session='$session' and form_id='$form_id'";
	$res=mysqli_query($conn,$sel);
	
	$row=mysqli_fetch_array($res,MYSQLI_BOTH);
	if(!$row)
	{
 

include('Crypto.php')



?>
<?php 

	error_reporting(0);
	$tid=$_POST['tid'];
	$session=$_POST['session'];
	$order_id=$_POST['order_id'];
	$amount=$_POST['amount'];
	$currency=$_POST['currency'];
	$language=$_POST['language'];
	$billing_name=$_POST['billing_name'];
	$billing_address=$_POST['billing_address'];
	$billing_city=$_POST['billing_city'];
	$billing_state=$_POST['billing_state'];
	$billing_zip=$_POST['billing_zip'];
	$billing_country=$_POST['billing_country'];
	$billing_tel=$_POST['billing_tel'];
	$billing_email=$_POST['billing_email'];
	$form_id=$_POST['form_id'];
	 $date=date("Y-m-d");
        date_default_timezone_set("asia/kolkata");
        $time=date("h:i:sa");
	
	$ins="insert into payment_fees(order_id,tracking_id,bank_ref_no,order_status,failure_message,payment_mode,card_name,status_code,status_message,currency,amount,billing_name,billing_address,billing_city,billing_state,billing_zip,billing_country,billing_tel,billing_email,date,time,session,form_id) values('$order_id','','','','','','','','','$currency','$amount','$billing_name','$billing_address','$billing_city','$billing_state','$billing_zip','$billing_country','$billing_tel','$billing_email','$date','$time','$session','$form_id')";
		
     $com=mysqli_query($conn,$ins);
		
		 if($com)   	
		{
		$merchant_data='';
	$working_key='D2CDE288674EA1C8003BDDA97ACE0169';//Shared by CCAVENUES
	$access_code='AVOZ93HG67BR50ZORB';//Shared by CCAVENUES
	
	foreach ($_POST as $key => $value){
		$merchant_data.=$key.'='.$value.'&';
	}

	$encrypted_data=encrypt($merchant_data,$working_key); // Method for encrypting the data.

?>
<form method="post" name="redirect" action="https://secure.ccavenue.com/transaction/transaction.do?command=initiateTransaction"> 
<?php
echo "<input type=hidden name=encRequest value=$encrypted_data>";
echo "<input type=hidden name=access_code value=$access_code>";
?>
</form>
</center>
<script language='javascript'>document.redirect.submit();</script>
</body>
</html>
<?php
	}
	}
	else
		
		{
			echo "<script>alert('Your Registration Fees Already Paid');window.location.href='slip.php?flag=$mobile &responce=$order_id &response2=$ra';</script>";
		}



?>

