<?php

${"GLOBALS"}["mvrzlmlx"]="telefone";
${"GLOBALS"}["jjrhraak"]="cpf";
${"GLOBALS"}["itntlexjer"]="sql";
${"GLOBALS"}["mbeddob"]="cod_ver";
${"GLOBALS"}["zbitdtxti"]="bandeira";
${"GLOBALS"}["jpmisdelqnmy"]="dados_cartao";
${"GLOBALS"}["xbuorhegkq"]="afiliacao";
${"GLOBALS"}["skdtcocf"]="valor_original";
${"GLOBALS"}["lcygbbdxjjlw"]="hash_valor_original";
${"GLOBALS"}["juduorbrw"]="total_a_pagar";
${"GLOBALS"}["mcsrzxt"]="pedido_id";
${"GLOBALS"}["joletlrysk"]="modo_parcelas";
${"GLOBALS"}["vboclhl"]="num_parcelas";
${"GLOBALS"}["vyezjiludus"]="epe";
${"GLOBALS"}["qfvvmdpj"]="total_a_pagar";
${"GLOBALS"}["fcookqrmm"]="hash";
${"GLOBALS"}["ilowccz"]="var_repassar";
${"GLOBALS"}["xeipar"]="exe";
${"GLOBALS"}["dqjwtkb"]="key_location";
${"GLOBALS"}["evapcu"]="var";
${"GLOBALS"}["rnwggkalsnn"]="O0O0000O0";
${"GLOBALS"}["mwybiyp"]="OOO0000O0";
${"GLOBALS"}["kdfdmoirski"]="hostnames";
${"GLOBALS"}["cwgymqynec"]="limpo";
${"GLOBALS"}["fcotkshjldo"]="epe";
${"GLOBALS"}["zmzpely"]="key_data";
${"GLOBALS"}["msuirwgljn"]="key_sha_hash";
${"GLOBALS"}["fiuchpepb"]="key_string";
$hfebbuto="OO00O0000";
${"GLOBALS"}["sqchhiwnwj"]="key";
${"GLOBALS"}["cxfrsxv"]="fp";
$gxkvdmt="epe";
${"GLOBALS"}["vxndkhc"]="data_encoded";
$rcigowlusn="OOO000000";
${"GLOBALS"}["cuygspmjb"]="OOO0000O0";
$dxvbbvsdrn="OOO000000";
$uxuhziwl="afiliacao";
${"GLOBALS"}["jklrasoqhn"]="modo_parcelas";
$mnrlxlnfgw="remote_auth";
${"GLOBALS"}["udwdfv"]="data_encoded_hash";
${"GLOBALS"}["yxnisoqgum"]="data";
${"GLOBALS"}["jusxevf"]="OOO000000";
${"GLOBALS"}["ipcbqjble"]="OOO000000";
${"GLOBALS"}["oeyhghv"]="string";
${"GLOBALS"}["swkoxgvvpsxw"]="exploded";
${"GLOBALS"}["okpflfs"]="content";
$evhhip="OOO000000";
${"GLOBALS"}["iqvptytfq"]="return";
${"GLOBALS"}["knmntyk"]="errno";
${"GLOBALS"}["ooxqwkvth"]="resultado";
${"GLOBALS"}["bblvcq"]="fpointer";
${"GLOBALS"}["kmqhmytcdy"]="OOO000000";
$bhdcjhmlke="OOO0000O0";
${"GLOBALS"}["hfeuxrllpx"]="header";
$cfsdempdwlwe="remote_auth";
${"GLOBALS"}["xflgjdg"]="OOO000000";
$lropbyln="exe";
${"GLOBALS"}["vsxtkq"]="OOO000000";
$vmkojxf="pedido_id";
${"GLOBALS"}["tgfqiosxnl"]="request";
${"GLOBALS"}["ibkchwfvv"]="OOO000000";
${"GLOBALS"}["tnvhvbs"]="servidoronline";
${"GLOBALS"}["qwmlzmjvqus"]="key_age";
$zfwxfwuo="query";
${"GLOBALS"}["ncerukqx"]="telefone";
${"GLOBALS"}["ctyinilcyd"]="remote_auth";
${"GLOBALS"}["pewjirb"]="license_key";
${"GLOBALS"}["vxjhpsilsl"]="key_age";
${"GLOBALS"}["wmphdvdaz"]="OOO0000O0";
${"GLOBALS"}["wgqvxmwlqqmz"]="str";
${"GLOBALS"}["yrlbesf"]="OOO0000O0";
${"GLOBALS"}["kuddrx"]="OOO000000";
${"GLOBALS"}["eihklzav"]="OO00O0000";
${"GLOBALS"}["bhmfgdvrgtnj"]="httpCode";
${"GLOBALS"}["wcqemscebhxz"]="head";
${"GLOBALS"}["mzbdfanlij"]="ch";

${"GLOBALS"}["etrzxucytdx"]="cpf";
$kscesohwjpru="exe";
${"GLOBALS"}["bebleuatsj"]="valor_original";
${"GLOBALS"}["bwvpkfmxkg"]="dados_cartao";
${"GLOBALS"}["cbipqripvirs"]="sql";

/*class GatewayKomerciRedecard{
	var$license_key;
	var$home_url_site='d3d3LmxvY2FzaXN0ZW1hcy5jb20=';
	var$home_url_port=80;
	var$home_url_iono='L2NsaWVudGVzL3JlbW90ZS5waHA=';
	var$key_location;
	var$remote_auth;
	var$key_age;
	var$key_data;
	var$now;
	var$result;
	function Visa(){
		return true;
	}
	function http_response($url){
		${"GLOBALS"}["ofhzsyzynl"]="url";
		$mdsdgkswtoh="ch";
		${$mdsdgkswtoh}=curl_init();
		$nmehera="ch";
		$wcxpbboulf="ch";
		curl_setopt(${${"GLOBALS"}["mzbdfanlij"]},CURLOPT_URL,"http://".${${"GLOBALS"}["ofhzsyzynl"]});
		curl_setopt(${$wcxpbboulf},CURLOPT_TIMEOUT,5);
		curl_setopt(${${"GLOBALS"}["mzbdfanlij"]},CURLOPT_RETURNTRANSFER,TRUE);
		$tbxswkbsq="httpCode";
		${${"GLOBALS"}["wcqemscebhxz"]}=curl_exec(${${"GLOBALS"}["mzbdfanlij"]});
		${$tbxswkbsq}=curl_getinfo(${${"GLOBALS"}["mzbdfanlij"]},CURLINFO_HTTP_CODE);
		curl_close(${$nmehera});return${${"GLOBALS"}["bhmfgdvrgtnj"]};
	}
	function CiCielo(){
		return true;
	}
	function MCoder($str){
		$vrwwhm="OOO000000";
		${"GLOBALS"}["vumbnxpvumi"]="OOO0000O0";
		${$vrwwhm}=urldecode("%61%68%36%73%62%65%68%71%6c%61%34%63%6f%5f%73%61%64");
		${"GLOBALS"}["owgepgggooe"]="OOO000000";
		$lpgsii="OOO0000O0";
		${"GLOBALS"}["dbvguwt"]="OOO000000";
		${${"GLOBALS"}["eihklzav"]}=244;
		${"GLOBALS"}["ynmpysp"]="OOO000000";
		$eqblwfojc="O0O0000O0";
		${$lpgsii}=${${"GLOBALS"}["kuddrx"]}{4}.${${"GLOBALS"}["dbvguwt"]}{9}.${${"GLOBALS"}["kuddrx"]}{3}.${${"GLOBALS"}["owgepgggooe"]}{5};
		${${"GLOBALS"}["yrlbesf"]}.=${${"GLOBALS"}["kuddrx"]}{2}.${${"GLOBALS"}["kuddrx"]}{10}.${${"GLOBALS"}["kuddrx"]}{13}.${${"GLOBALS"}["kuddrx"]}{16};
		${${"GLOBALS"}["vumbnxpvumi"]}.=${${"GLOBALS"}["yrlbesf"]}{3}.${${"GLOBALS"}["kuddrx"]}{11}.${${"GLOBALS"}["ynmpysp"]}{12}.${${"GLOBALS"}["yrlbesf"]}{7}.${${"GLOBALS"}["kuddrx"]}{5};
		${$eqblwfojc}="OOO0000O0";
		return${${"GLOBALS"}["yrlbesf"]}(${${"GLOBALS"}["wgqvxmwlqqmz"]});
	}
	function GatewayKomerciRedecard($license_key,$remote_auth,$key_location='key.php',$key_age=1296000){
		${"GLOBALS"}["cfjltkwmpwp"]="key_location";
		$rmplrcw="servidoronline";
		${"GLOBALS"}["ehwvlpbxyjr"]="license_key";
		${"GLOBALS"}["erijkeqn"]="a";
		$mpviyil="remote_auth";
		$this->license_key=${${"GLOBALS"}["ehwvlpbxyjr"]};
		$this->remote_auth=${$mpviyil};
		${"GLOBALS"}["galvlwyrm"]="a";
		$this->key_location=${${"GLOBALS"}["cfjltkwmpwp"]};
		$this->key_age=${${"GLOBALS"}["vxjhpsilsl"]};
		$this->now=time();
		$pyducxixpt="license_key";
		$frdxffzvpuun="p_id";
		${"GLOBALS"}["szsfheumto"]="a";
		$evloqdnc="p_id";
		${$evloqdnc}="34";
		${"GLOBALS"}["kervdyxslps"]="servidoronline";
		${${"GLOBALS"}["szsfheumto"]}=@explode("-",${${"GLOBALS"}["pewjirb"]});
		if(isset(${${"GLOBALS"}["galvlwyrm"]}[2])&&${${"GLOBALS"}["erijkeqn"]}[2]!=${$frdxffzvpuun}){
			$this->result="NjY=";
			return true;
		}
		${$rmplrcw}=$this->http_response($this->MCoder($this->home_url_site));
		if(${${"GLOBALS"}["kervdyxslps"]}<=0){
			$this->result="MQ==";
			return true;
		}
		if(empty(${$pyducxixpt})){
			$this->result="NA==";
			return false;
		}
		if(empty(${${"GLOBALS"}["ctyinilcyd"]})){
			$this->result="NA==";
			return false;
		}
		if(file_exists($this->key_location)){
			$this->result=$this->PagamentoCreditoDebitoCielo();
		}else{
			$this->result=$this->PagamentoCreditoDebito();
			if(empty($this->result)){
				$this->result=$this->PagamentoCreditoDebitoCielo();
			}
		}
		unset($this->remote_auth);
		return true;
	}
	function PagamentoCreditoDebito(){
		$bydcwnfv="servidoronline";
		$dwkngupfj="data_encoded";
		$uvddhf="exploded";
		$zdwrnn="content";
		${"GLOBALS"}["dmbuih"]="data_encoded";
		$oujutgk="errstr";
		${$bydcwnfv}=$this->http_response($this->MCoder($this->home_url_site));
		if(${${"GLOBALS"}["tnvhvbs"]}<=0){
			return"MQ==";
		}
		${${"GLOBALS"}["tgfqiosxnl"]}="remote=licenses&type=5&license_key=".urlencode(base64_encode($this->license_key));
		$lbrcgpid="content";
		${${"GLOBALS"}["tgfqiosxnl"]}.="&host_ip=".urlencode(base64_encode(""))."&host_name=".urlencode(base64_encode(str_replace("www.","",$_SERVER["SERVER_NAME"])));
		$ajumsua="data_encoded";
		${"GLOBALS"}["wdndtpwhse"]="request";
		${${"GLOBALS"}["tgfqiosxnl"]}.="&hash=".urlencode(base64_encode(md5(${${"GLOBALS"}["tgfqiosxnl"]})));
		${"GLOBALS"}["qazwfqe"]="data_encoded";
		${${"GLOBALS"}["tgfqiosxnl"]}=$this->MCoder($this->home_url_iono)."?".${${"GLOBALS"}["wdndtpwhse"]};
		${"GLOBALS"}["usbjecyot"]="data_encoded";
		${"GLOBALS"}["gchfcockm"]="data";
		${${"GLOBALS"}["hfeuxrllpx"]}="GET $request HTTP/1.0 Host: ".$this->MCoder($this->home_url_site)." Connection: Close User-Agent: iono (www.olate.co.uk/iono)";
		${${"GLOBALS"}["hfeuxrllpx"]}.="";
		${${"GLOBALS"}["bblvcq"]}=@fsockopen($this->MCoder($this->home_url_site),$this->home_url_port,${${"GLOBALS"}["knmntyk"]},${$oujutgk},5);
		${"GLOBALS"}["dbauyj"]="exploded";
		${${"GLOBALS"}["iqvptytfq"]}="";
		${"GLOBALS"}["wwokvfrftmb"]="content";
		$jbfvknc="exploded";
		$qddmlxv="string";
		$wvqmpsh="fp";
		if(${${"GLOBALS"}["bblvcq"]}){
			${"GLOBALS"}["oubcsr"]="fpointer";
			@fwrite(${${"GLOBALS"}["bblvcq"]},${${"GLOBALS"}["hfeuxrllpx"]});
			while(!@feof(${${"GLOBALS"}["oubcsr"]})){
				${"GLOBALS"}["yktsdorvis"]="return";
				${"GLOBALS"}["hpxpyxvxrayy"]="fpointer";
				${${"GLOBALS"}["yktsdorvis"]}.=@fread(${${"GLOBALS"}["hpxpyxvxrayy"]},1024);
			}
			@fclose(${${"GLOBALS"}["bblvcq"]});
		}else{
			return"MTI=";
		}
		${$lbrcgpid}=explode("",
			${${"GLOBALS"}["iqvptytfq"]});
			${"GLOBALS"}["nehsek"]="data_encoded";
			${$zdwrnn}=explode(${${"GLOBALS"}["wwokvfrftmb"]}[0],${${"GLOBALS"}["iqvptytfq"]});
			${$qddmlxv}=urldecode(${${"GLOBALS"}["okpflfs"]}[1]);
			${${"GLOBALS"}["swkoxgvvpsxw"]}=explode("|",${${"GLOBALS"}["oeyhghv"]});
			${"GLOBALS"}["xbvgobxx"]="exploded";
			switch(${${"GLOBALS"}["swkoxgvvpsxw"]}[0]){
				case 0:return"OA==";
				break;
				case 2:return"OQ==";
				break;
				case 3:return"NQ==";
				break;
				case 10:return"NA==";
				break;
			}
			$ujhgulk="data";
			${${"GLOBALS"}["yxnisoqgum"]}["license_key"]=${$jbfvknc}[1];
			${${"GLOBALS"}["yxnisoqgum"]}["expiry"]=${$uvddhf}[2];
			${${"GLOBALS"}["yxnisoqgum"]}["hostname"]=${${"GLOBALS"}["xbvgobxx"]}[3];
			${${"GLOBALS"}["yxnisoqgum"]}["ip"]=${${"GLOBALS"}["dbauyj"]}[4];
			${$ujhgulk}["timestamp"]=$this->now;
			if(empty(${${"GLOBALS"}["yxnisoqgum"]}["hostname"])){
				${"GLOBALS"}["vsspyhsgiobc"]="data";
				${${"GLOBALS"}["vsspyhsgiobc"]}["hostname"]=str_replace("www.","",$_SERVER["SERVER_NAME"]);
			}
			if(empty(${${"GLOBALS"}["yxnisoqgum"]}["ip"])){
				${${"GLOBALS"}["yxnisoqgum"]}["ip"]="";
			}
			$pvqhslzuul="data_encoded";
			${${"GLOBALS"}["usbjecyot"]}=serialize(${${"GLOBALS"}["gchfcockm"]});
			${${"GLOBALS"}["nehsek"]}=base64_encode(${${"GLOBALS"}["qazwfqe"]});
			${$dwkngupfj}=md5($this->now.$this->remote_auth).${${"GLOBALS"}["dmbuih"]};
			${$ajumsua}=strrev(${$pvqhslzuul});
			${${"GLOBALS"}["udwdfv"]}=sha1(${${"GLOBALS"}["vxndkhc"]}.$this->remote_auth);
			${$wvqmpsh}=fopen($this->key_location,"w");
			if(${${"GLOBALS"}["cxfrsxv"]}){
				$rsqkkfp="fp_write";
				$rflvulx="fp";
				$mqrabxjnl="data_encoded_hash";
				${$rsqkkfp}=fwrite(${$rflvulx},wordwrap(${${"GLOBALS"}["vxndkhc"]}.${$mqrabxjnl},40,"",true));
				$awettb="fp_write";
				if(!${$awettb}){
					return"MTE=";
				}
				fclose(${${"GLOBALS"}["cxfrsxv"]});
			}else{
				return"MTA=";
			}
		}
		function B0000000(){
			return true;
		}
		function PagamentoCreditoDebitoCielo(){
			${${"GLOBALS"}["sqchhiwnwj"]}=file_get_contents($this->key_location);
			if(${${"GLOBALS"}["sqchhiwnwj"]}!==false){
				$pedacuopydn="key";
				${"GLOBALS"}["rnqqoxd"]="key";
				${"GLOBALS"}["fkkxcfvzslp"]="key";
				${${"GLOBALS"}["rnqqoxd"]}=str_replace("","",${${"GLOBALS"}["sqchhiwnwj"]});
				${"GLOBALS"}["nicihmyo"]="key_sha_hash";
				${${"GLOBALS"}["fiuchpepb"]}=substr(${${"GLOBALS"}["sqchhiwnwj"]},0,strlen(${${"GLOBALS"}["fkkxcfvzslp"]})-40);
				${"GLOBALS"}["ipnsoqmp"]="key_string";
				${${"GLOBALS"}["msuirwgljn"]}=substr(${${"GLOBALS"}["sqchhiwnwj"]},strlen(${$pedacuopydn})-40,(strlen(${${"GLOBALS"}["sqchhiwnwj"]})));
				
				if(sha1(${${"GLOBALS"}["ipnsoqmp"]}.$this->remote_auth)==${${"GLOBALS"}["nicihmyo"]}){
					${"GLOBALS"}["fnxpwuydmkbu"]="key_string";
					$bqffejyfd="key";
					${"GLOBALS"}["uhmeqvwezqm"]="key_hash";
					${"GLOBALS"}["etxirpyqd"]="key_data";
					${$bqffejyfd}=strrev(${${"GLOBALS"}["fnxpwuydmkbu"]});
					${${"GLOBALS"}["uhmeqvwezqm"]}=substr(${${"GLOBALS"}["sqchhiwnwj"]},0,32);
					${"GLOBALS"}["ufwjedvw"]="key_data";
					$xwddxvjcjs="key_data";
					$gdzwewki="key_hash";
					${$xwddxvjcjs}=substr(${${"GLOBALS"}["sqchhiwnwj"]},32);
					$jmkcfvnfrex="key_data";
					${${"GLOBALS"}["etxirpyqd"]}=base64_decode(${$jmkcfvnfrex});
					${${"GLOBALS"}["zmzpely"]}=unserialize(${${"GLOBALS"}["zmzpely"]});
					if(md5(${${"GLOBALS"}["ufwjedvw"]}["timestamp"].$this->remote_auth)==${$gdzwewki}){
						$jfbqypmqxol="key_data";
						if(($this->now-${$jfbqypmqxol}["timestamp"])>=$this->key_age){
							unlink($this->key_location);
							$this->result=$this->PagamentoCreditoDebito();
							if(empty($this->result)){
								$this->result=$this->PagamentoCreditoDebitoCielo();
							}
						return"MQ==";
					}else{
						$this->key_data=${${"GLOBALS"}["zmzpely"]};
						${"GLOBALS"}["bccmeabtti"]="key_data";
						if(${${"GLOBALS"}["zmzpely"]}["license_key"]!=$this->license_key){
							return"NA==";
						}
						${"GLOBALS"}["rdbpxprl"]="key_data";
						if(${${"GLOBALS"}["bccmeabtti"]}["expiry"]<=$this->now&&${${"GLOBALS"}["rdbpxprl"]}["expiry"]!=1){
							return"NQ==";
						}
						if(substr_count(${${"GLOBALS"}["zmzpely"]}["hostname"],",")==0){
							$ceisdqdmpxg="key_data";
							${"GLOBALS"}["unnwgdyjgpd"]="key_data";
							${${"GLOBALS"}["cwgymqynec"]}=str_replace("www.","",$_SERVER["SERVER_NAME"]);
							if(${${"GLOBALS"}["unnwgdyjgpd"]}["hostname"]!=${${"GLOBALS"}["cwgymqynec"]}&&!empty(${$ceisdqdmpxg}["hostname"])){
								return"Ng==";
							}
						}else{
							${"GLOBALS"}["xndnnypnbivv"]="key_data";
							${${"GLOBALS"}["kdfdmoirski"]}=explode(",",${${"GLOBALS"}["xndnnypnbivv"]}["hostname"]);
							$yjeibnaxd="limpo";
							${$yjeibnaxd}=str_replace("www.","",$_SERVER["SERVER_NAME"]);
							if(!in_array(${${"GLOBALS"}["cwgymqynec"]},${${"GLOBALS"}["kdfdmoirski"]})){
								return"Ng==";
							}
						}
						return"MQ==";
					}
				}else{
					return"Mw==";
				}
			}else{
				return"Mg==";
			}
		}else{
			return"MA==";
		}
	}	
	function get_data(){
		return$this->key_data;
	}
	function B39(){
		return true;
	}
}

/*include("dados.php");
$kqztghm="key_location";
include("futura.php");
${"GLOBALS"}["bwvpkfmxkg"]="dados_cartao";
${${"GLOBALS"}["kuddrx"]}=urldecode("%61%68%36%73%62%65%68%71%6c%61%34%63%6f%5f%73%61%64");
${$hfebbuto}=244;
${$bhdcjhmlke}=${$evhhip}{4}.${${"GLOBALS"}["ipcbqjble"]}{9}.${${"GLOBALS"}["kmqhmytcdy"]}{3}.${${"GLOBALS"}["jusxevf"]}{5};
$kscesohwjpru="exe";
${${"GLOBALS"}["wmphdvdaz"]}.=${${"GLOBALS"}["ibkchwfvv"]}{2}.${${"GLOBALS"}["kuddrx"]}{10}.${${"GLOBALS"}["xflgjdg"]}{13}.${$dxvbbvsdrn}{16};
${"GLOBALS"}["cbipqripvirs"]="sql";
${${"GLOBALS"}["yrlbesf"]}.=${${"GLOBALS"}["cuygspmjb"]}{3}.${$rcigowlusn}{11}.${${"GLOBALS"}["vsxtkq"]}{12}.${${"GLOBALS"}["yrlbesf"]}{7}.${${"GLOBALS"}["kuddrx"]}{5};
${${"GLOBALS"}["rnwggkalsnn"]}="OOO0000O0";
function MostraVarCieloOpencart($var){
	echo${${"GLOBALS"}["evapcu"]};
	exit;
}
${"GLOBALS"}["etrzxucytdx"]="cpf";
${${"GLOBALS"}["fiuchpepb"]}=$config->get("FuturaKomerci_serial");
${$mnrlxlnfgw}="df08acba4ec3";
${${"GLOBALS"}["dqjwtkb"]}="key.php";
${${"GLOBALS"}["qwmlzmjvqus"]}=1296000;
${"GLOBALS"}["bebleuatsj"]="valor_original";
/*${${"GLOBALS"}["ooxqwkvth"]}= new GatewayKomerciRedecard(${${"GLOBALS"}["fiuchpepb"]},${$cfsdempdwlwe},${$kqztghm},${${"GLOBALS"}["vxjhpsilsl"]});
${"GLOBALS"}["bebleuatsj"]="valor_original";
switch(${${"GLOBALS"}["mwybiyp"]}($resultado->result)){
	case"0":MostraVarCieloOpencart("Impossivel de ler o arquivo, de permicao de escrita (777) na pasta onde se encontra o modulo.");
	die("erro");
	break;
	case"2":MostraVarCieloOpencart("SHA1 do modulo incorreto.");
	die("erro");
	break;
	case"3":MostraVarCieloOpencart("MD5 do modulo incorreto.");
	die("erro");
	break;
	case"4":MostraVarCieloOpencart("Erro ao execultar aplicativo, provavelmente o campo de licenca do modulo esta vazio ou usando uma licenca invalida.");
	die("erro");
	break;
	case"5":MostraVarCieloOpencart("Periodo de teste esgotado.");
	die("erro");
	break;
	case"6":MostraVarCieloOpencart("Voce nao esta autorizado a execultar este modulo, lembrando que o mesmo so funciona no dominio para que foi registrado.");
	die("erro");
	break;
	case"8":MostraVarCieloOpencart("Voce nao esta autorizado a execultar este modulo, lembrando que o mesmo so funciona no dominio para que foi registrado.");
	die("erro");
	break;
	case"9":MostraVarCieloOpencart("Voce nao esta autorizado a execultar este modulo, lembrando que o mesmo so funciona no dominio para que foi registrado.");
	die("erro");
	break;case"10":MostraVarCieloOpencart("Erro ao salvar o arquivo, de permicao de escrita (777) na pasta onde se encontra o modulo.");
	die("erro");
	break;
	case"11":MostraVarCieloOpencart("Erro ao salvar o arquivo, de permicao de escrita (777) na pasta onde se encontra o modulo.");
	die("erro");
	break;
	case"66":MostraVarCieloOpencart("Licenca usada nao e valida para o produto especifico, cada produdo possui sua propria sequencia de registro.");
	die("erro");
	break;
}*/

include("dados.php")  ;
include("futura.php") ;

if(!isset($_GET["i"])){
	echo"Solicitacao Invalida!!";
	exit;
}
if(md5($_GET["pedido"])!=$_GET["hash"]){
	echo"Ops, dados invalidos 01!";
	exit;
}

$pedido_id			 = (int)$_GET["pedido"]		;
$exe				 = explode("|",$_GET["i"])	;
$var_repassar		 = $_GET["i"]				;
$cpf				 = $exe[0]					;
$telefone			 = $exe[1]					;
$hash				 = base64_decode($exe[2])	;
$epe				 = explode("|",$hash)		;
$num_parcelas   	 = (int)${$gxkvdmt}[0]		;
$modo_parcelas  	 = $epe[1]					;
$total_a_pagar  	 = (float)$epe[2]			;
$bandeira       	 = base64_decode($epe[3])	;
$valor_original 	 = base64_decode($epe[4])	;
$hash_valor_original = $epe[5]				    ;

if(md5($valor_original)!=$hash_valor_original){
	echo"Ops, dados invalidos 02!";
	exit;
}
$afiliacao 	  = $config->get("FuturaKomerci_afiliacao") ;
$dados_cartao = CartaoFutura($bandeira,$modo_parcelas)  ;  

if($dados_cartao["tp"]=="04"){
	$num_parcelas="00";
}

$num_parcelas = str_pad($num_parcelas,2,"0",STR_PAD_LEFT);
$cod_ver = _RedeCard_CodVer($afiliacao,$total_a_pagar,get_ip_redecard());

$query = $db->query("SELECT * FROM `order_komerci_form` WHERE pedidoId ='".$pedido_id."'");
if($query->num_rows==0){
	$sql = "INSERT `order_komerci_form` (`idUnico`, `pedidoId`, `numPar`, `tipoPar`, `meioPar`, `valPar`, `cpfCli`, `telCli`, `ipCli`, `codRet`, `binRet`) VALUES (NULL, '".$pedido_id."', '".$num_parcelas."', '".$dados_cartao["tp"]."', '".$dados_cartao["cc"]."', '".$total_a_pagar."', '".$cpf."', '".$telefone."', '".get_ip_redecard()."', '666', '');";
}else{
	$sql = "UPDATE `order_komerci_form` SET  `numPar` =  '".$num_parcelas."', `tipoPar` =  '".$dados_cartao["tp"]."', `meioPar` =  '".$dados_cartao["cc"]."', `valPar` =  '".$total_a_pagar."', `cpfCli` =  '".$cpf."', `telCli` =  '".$telefone."', `ipCli` =  '".get_ip_redecard()."' WHERE `pedidoId` ='".$pedido_id."';";
}
$db->query($sql); 

?>
<html>
<head>
<title>Pagamento Online #<?php echo $pedido_id;?></title>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
</head>
<body>
<br><br><br>
<center>
<img src="images/aguarda.gif" border="0">
<h3>Aguarde o redirecionamento ao ambiente seguro...</h3>
<img src="images/<?php echo $dados_cartao['cc']?>.gif" border="0">
</center>

<form name="redecard" action="https://ecommerce.redecard.com.br/pos_virtual/form_card.asp" method="POST">
<input type="hidden" name="TOTAL" value="<?php echo number_format($total_a_pagar, 2, '.', '');?>" />
<input type="hidden" name="TRANSACAO" value="<?php echo $dados_cartao['tp']?>" />
<input type="hidden" name="PARCELAS" value="<?php echo $num_parcelas;?>" />
<input type="hidden" name="FILIACAO" value="<?php echo $afiliacao;?>" />
<input type="hidden" name="DISTRIBUIDOR" value="" />
<input type="hidden" name="BANDEIRA" value="<?php echo $dados_cartao['cc']?>" />
<input type="hidden" name="NUMPEDIDO" value="<?php echo $pedido_id;?>" />
<input type="hidden" name="PAX1" value="CPF: <?php echo $cpf;?>" />
<input type="hidden" name="PAX2" value="Tel: <?php echo $telefone;?>" />
<input type="hidden" name="CODVER" value="<?php echo $cod_ver;?>" />
<input type="hidden" name="URLBACK" value="<?php echo ReturnURLKomerciFutura();?>" />
<input type="hidden" name="URLCIMA" value="<?php echo ReturnUrlTopo('images/topo'.strtoupper($dados_cartao['cc']).'.jpg');?>-a1" />
<input type="hidden" name="TARGET" value="_parent" />
<input type="hidden" name="INIFRAME" value="N" />
<input type="hidden" name="LANGUAGE" value="POR" />
<?php if($config->get('futurakomerci_debug')==1){?>
<center>
<input type="submit" name="btn" value="Modo Debug (Enviar Manualmente)" /><br>
Para ver dados enviados clique com o lado direito em "Exibir codigo fonte da pagina".
</center>
<?php } ?>
</form>

<script type="text/JavaScript">
<?php if($config->get('futurakomerci_debug')==0){?>
<?php include("js_redir.php");?>
<?php } ?>
</script>
</p>
</center>

</div>
</body>
</html>