<?php
session_start();
include 'config.php';

$_SESSION['usuario'] = "REPLICA";
$_SESSION['clave'] = "REPLICA";

$sql = "SELECT AUTO_FECHA, AUTO_VENCE, AUTO_INICIAL, AUTO_FINAL FROM AUTORIZACIONES WHERE AUTO_NUMERO = '".$_GET["auto"]."' AND PREF_PRE = '".$_GET["pref"]."'";

try {
	$dbh = new PDO("firebird:dbname=$dbname", $_SESSION['usuario'], $_SESSION['clave']);	
	$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	$stmt = $dbh->prepare($sql);
	$stmt->execute();
	$vend = $stmt->fetchAll(PDO::FETCH_OBJ);
	$dbh = null;
	echo json_encode($vend); 
} catch(PDOException $e) {
	echo '{"items":[{"VEND":"0","NOMBRE":"NO EXISTE"}]}';
}


?>