 <?php
$dbHost = 'localhost';
$dbUser = 'getidbiz_getidw';
$dbPass = 'g3t!d';
$dbName = 'getidbiz_wines2u';

$dbConn = mysql_connect ($dbHost, $dbUser, $dbPass) or die ('MySQL connect failed. ' . mysql_error());
mysql_select_db($dbName) or die('Cannot select database. ' . mysql_error());
		
		$Order_id = $_POST["item_number"];
		$trsx_id = $_POST['txn_id'];

	if ($Order_id) {
	$result = mysql_query("set names 'utf8'");
	//$result = mysql_query("SELECT * FROM cc_transactions WHERE cc_order_id='".$Order_id."'");
	$result = mysql_query("SELECT * FROM cc_transactions WHERE cc_ref='".$Order_id."'");
		
		
	if (!$result) {
		echo "[BAD], Order_id=".$Order_id;
	} else {
		$row = mysql_fetch_row($result);
		//$cc_amount = $row[1];
		$cc_order_ref = $row[1];
		$cc_order_id = $row[4];
		//$cc_amount=$cc_amount/100;
		//$sum = number_format($cc_amount, 2, '.', '');
		
		//if (($B_merch_ID=="90003414") && ($B_amount==$sum) && ($B_curr=="978") && ($B_order_id==$cc_ref)) {
		//echo "[OK]";
		//} else {
		//echo "[NOK], Shop: ".$B_merch_ID."=90003414, Amount: ".$B_amount."=".$sum.", Currency: ".$B_curr."=978, Ref: ".$B_order_id."=".$cc_ref;
		//}
		echo $cc_order_ref;?>
		<meta http-equiv="REFRESH" content="0;url=http://www.wines2u.gr/paypal_payment_successful/<?=$cc_order_id?>">
		<? //header('Location: http://www.myfob.gr/payment_successful_new/'.$cc_order_id);
	}
	} else {
	echo "Not posting anything";	
	}
		mysql_free_result($result);
		mysql_close($dbConn);
?>