<?php 
		header('Content-type: text/html; charset=utf-8');
		$path="../../../../";
		include("".$path."deppo/tools/script/cevir.php");
		$path2="config/"; include("".$path."config/map.php");
		include("".$path."deppo/tools/script/fonksiyon".$ver.".php");
		$sql = mysqli_query($conn, "select * from genel where ne='banka' and s1=16 and s2=1"); $rsb = mysqli_fetch_assoc($sql);
		$kart_numarasi						= $_POST['kart_numarasi'];
		$kart_sonkullanma_tarihi_ay 	= $_POST['kart_sonkullanma_tarihi_ay'];
		$kart_sonkullanma_tarihi_yil 	= $_POST['kart_sonkullanma_tarihi_yil'];
		$kart_guvenlik_kodu 				= $_POST['kart_guvenlik_kodu'];
		
		$email				 					= $_POST['email'];
		$tutar				 					= str_replace(",", "", $_POST["tutar"]);
		$taksit				 					= $_POST['taksit'];
		$order_id				 				= $_POST['order_id'];
		$strSuccessURL   				= "".$_POST["aurl"]."/deppo/tools/vpos/garanti/return.php?burl=".$_POST['burl']."";
		$strErrorURL 						= "".$_POST["aurl"]."/deppo/tools/vpos/garanti/return.php?burl=".$_POST['burl']."";
		$strMode 								= "PROD";
		$strApiVersion 						= "v0.01";
		$strTerminalProvUserID 			= "PROVAUT";
		$strType	 							= "sales";
		$strAmount 							= ($tutar)*100;
		$strCurrencyCode 					= "949";
		$strInstallmentCount 				= $taksit; 
		$strTerminalUserID 				= $order_id;
		$strOrderID 							= $order_id;
		$strcustomeremailaddress 		= $email;
		$strCustomeripaddress 			= $_SERVER['REMOTE_ADDR'];
		$strTerminalID 						= $rsb["n2"];
if($rsb["n9"]<>""){
		$strSubMerchantID 				= $rsb["n9"];
}
		$strTerminalID_ 					= "0".$strTerminalID;
		$strTerminalMerchantID 			= $rsb["n1"];
		$strStoreKey 						= $rsb["n5"];
		$strProvisionPassword 			= $rsb["n4"]; 
		$secure3dsecuritylevel 			= "3D_PAY"; 
		$SecurityData 						= strtoupper(sha1($strProvisionPassword.$strTerminalID_));
		$HashData 							= strtoupper(sha1($strTerminalID.$strOrderID.$strAmount.$strSuccessURL.$strErrorURL.$strType.$strInstallmentCount.$strStoreKey.$SecurityData));
		
		$form = "";
		$form .= '<form action="https://sanalposprov.garanti.com.tr/servlet/gt3dengine" method="post" name="FormGarantiOdeme" id="FormGarantiOdeme" >
		<input type="hidden" name="secure3dsecuritylevel" value="'.$secure3dsecuritylevel.'"  />
		<input type="hidden" name="cardnumber" value="'. $kart_numarasi  .'" />
		<input type="hidden" name="cardexpiredatemonth" value="'. $kart_sonkullanma_tarihi_ay  .'" />
		<input type="hidden" name="cardexpiredateyear" value="'. $kart_sonkullanma_tarihi_yil .'" />
		<input type="hidden" name="cardcvv2" value="'. $kart_guvenlik_kodu .'"/>
		<input type="hidden" name="mode" value="'. $strMode .'" />
		<input type="hidden" name="apiversion" value="'. $strApiVersion .'" />
		<input type="hidden" name="terminalprovuserid" value="'. $strTerminalProvUserID .'" />
		';
		if($rsb["n9"]<>""){
			$form .= '<input type="hidden" name="SubMerchantID" value="'. $strSubMerchantID .'" />';
		}
		$form .= '
		<input type="hidden" name="terminaluserid" value="'. $strTerminalUserID .'" />
		<input type="hidden" name="terminalmerchantid" value="'. $strTerminalMerchantID .'" />
		<input type="hidden" name="txntype" value="'. $strType .'" />
		<input type="hidden" name="txnamount" value="'. $strAmount .'" />
		<input type="hidden" name="txncurrencycode" value="'. $strCurrencyCode .'" />
		<input type="hidden" name="txninstallmentcount" value="'. $strInstallmentCount .'" />
		<input type="hidden" name="orderid" value="'. $strOrderID .'" />
		<input type="hidden" name="terminalid" value="'. $strTerminalID .'" />
		<input type="hidden" name="successurl" value="'. $strSuccessURL .'" />
		<input type="hidden" name="errorurl" value="'. $strErrorURL .'" />
		<input type="hidden" name="customeripaddress" value="'. $strCustomeripaddress .'" />
		<input type="hidden" name="customeremailaddress" value="'. $strcustomeremailaddress .'" />
		<input type="hidden" name="secure3dhash" value="'. $HashData .'" />
		<input type="hidden" name="lang" value="tr" />
		</form>';
		
		$form .= '<script type="text/javascript">document.FormGarantiOdeme.submit();</script>';
		
		echo $form;
		exit();
?>