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

<?php include('Crypto.php');


?>

<?php require_once 'config.php';

require_once'../lib/dbclass.php';
?>

<?php
extract($_POST);
$data = $_REQUEST;

error_reporting(0);


//error_reporting ( 1 );

$_POST['merchant_id']     = CCA_MERCHANT_ID;
$_POST['language']        = 'EN';
$_POST['amount']          = $data['amount'];
$_POST['currency']        = 'INR';
$_POST['billing_name']    = $data['name'];
$_POST['billing_tel']     = $data['mobile'];
$_POST['billing_address'] = 'NA';
$_POST['billing_zip']     = '673634';
$_POST['billing_email']   = 'na@mail.com';
$_POST['billing_country'] = 'India';
$_POST['billing_city']    = 'India';
$_POST['billing_state']   = 'India';



$_POST['redirect_url'] = 'https://www.chcentertirur.in/ccavenue/ccavResponseHandler.php';

$merchant_data = '';
$working_key   = CCA_WORKING_KEY;
$access_code   = CCA_ACCESS_CODE;
$orderId       = rand(10, 10000000);

foreach ($_POST as $key => $value) {
    $merchant_data .= $key . '=' . urlencode($value) . '&';
}
$merchant_data .= 'order_id=' . $orderId;

$encrypted_data = encryption($merchant_data, $working_key);
$id             = $data['id'];




updateQuery("update tbl_transaction set orderid='$orderId' WHERE customerid=$id");



?>
<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>