<?
session_name('portal_absa');
session_start();
if(!isset($_SESSION['usuario_p_prov_absa']) || trim($_SESSION['usuario_p_prov_absa']) == "" || trim(strtoupper($_SESSION["URL_PORTAL"]."admin.php")) != trim(strtoupper($_SERVER['HTTP_REFERER']))){
	?><script>window.location.href="<?=$_SESSION["URL_PORTAL"]."index.php"?>"</script><?
	exit;
}
require_once('../WS//lib/nusoap.php');
require_once('../WS/ws_SAT.php');
require_once('../conexion/conectar.php');

$conexion = new CONDB();
$conexion->conectar();

$re=$_REQUEST["id"];
$serie=$_REQUEST["id2"];
$folio=$_REQUEST["id3"];
$uuid=$_REQUEST["id4"];
$tipodocto=$_REQUEST["id5"];
$numeroevento=$_REQUEST["id6"];
$query ="select request,response from detallerecibedoce where numeroevento=$numeroevento and rfcemisor='$re' and tipodocto='$tipodocto' and serie='$serie' and folio='$folio' and uuid='$uuid'";
$rSAT = mysqli_query($conexion->CONEXION,$query);

if(mysqli_num_rows($rSAT) > 0){
	$tmpSAT = mysqli_fetch_array($rSAT,MYSQLI_ASSOC);
	$request = $tmpSAT['request'];
	$response = $tmpSAT['response'];
}else{
	echo "No se encontro el request de la verificación del CFDI,<br/>vuelva a intentar verificarlo.";
	exit;
}
echo htmlspecialchars($request,ENT_QUOTES);
