<?

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */

  include "../application.php";
  include "egold.inc.php";

	ignore_user_abort(true);
	set_time_limit(0);

	@extract($_GET);
	@extract($_POST);
	@extract($_COOKIE);
	@extract($_SESSION);
	@extract($_SERVER);


	$h1 = $_SERVER['HTTP_REFERRER'];
	$h2 = $_SERVER['REMOTE_ADDR'];
	$h2 = substr($h2,0,11);
	if ($h2!="63.240.230.") {
		exit;
	}


	$status = 1;

	if ($_usev2check==1) {
		$hashstr = $_POST['PAYMENT_ID'] . ":" . $_POST['PAYEE_ACCOUNT'] . ":" . $_POST['PAYMENT_AMOUNT'] . ":1:1:" . $_POST['PAYMENT_BATCH_NUM'] . ":" . $_POST['PAYER_ACCOUNT'] . ":" . strtoupper($_acct_alt_hash) . ":" . $_POST['ACTUAL_PAYMENT_OUNCES'] . ":" . $_POST['USD_PER_OUNCE'] . ":" . $_POST['FEEWEIGHT'] . ":" . $_POST['TIMESTAMPGMT'];
		if($_POST['V2_HASH']!=strtoupper(md5($hashstr))) {
			$status = 0;
		}
	}

	$amount = $_POST["PAYMENT_AMOUNT"];
	$batch = $_POST["PAYMENT_BATCH_NUM"];
	$egold = $_POST["PAYER_ACCOUNT"];
	$gmt = $_POST["TIMESTAMPGMT"];
	if ($egold=="" || $amount=="" || $batch=="" || $gmt=="") {
		exit;
	}

  // get the custom value
  $raw          = explode('&',urldecode($_POST['CUSTOM']));
  $val_username = $raw[0];
  $val_type     = $raw[1];
  $val_id       = $raw[2];

  // mark invoice as paid
  MarkAsPaid($val_id);

?>
