<?



session_start();



$res = http_post("www.nochex.com", 80, "/nochex.dll/apc/apc", $_POST);



$payment_status = $_POST['status'];

$payment_gross = $_POST['amount'];

$payment_currency = 'GBP';

$txn_id = $_POST['transaction_id'];



list($trn_id, $typeofpay) = explode('||',$_POST['order_id']);



if ($log) fputs($fh, ">   " . $res);



if (strstr($res, 'AUTHORISED'))

{

	if (trim($payment_status) == 'live')

	{

		$process_fee = new fees();

		$process_fee->setts = &$setts;



		$process_fee->callback_process($custom, $fee_table, $active_pg, $payment_gross, $txn_id, $payment_currency);



		if ($log) fputs($fh, "\n* Nochex Payment Accepted (Live)\n");

	}

	else

	{

		if ($log) fputs($fh, "\n* Nochex Payment Accepted (Test Mode!)\n");

	}



$checkpay="yes";

$_SESSION['checkpay'] = $checkpay;

$_SESSION['txn_id'] = $txn_id;

$_SESSION['trn_id'] = $trn_id;

echo '<meta http-equiv="refresh" content="0; url=redirections.php?typeofpay='.$typeofpay.'">';

exit();

}

else

{

	if ($log) fputs($fh, "* Nochex Payment Declined.\n");



$checkpay="yes";

$_SESSION['checkpay'] = $checkpay;

$_SESSION['txn_id'] = $txn_id;

$_SESSION['trn_id'] = $trn_id;

echo '<meta http-equiv="refresh" content="0; url=redirections.php?typeofpay='.$typeofpay.'">';

exit();

}



header_redirect($redirect_url);

?>