<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);
 if (isset($_REQUEST['passport'])) {
$passport = $_REQUEST['passport'];

$qry = mysqli_query($conn, "SELECT  a.myvouch,a.mofa_date,a.stampdate,a.paxname,a.mofano,
                                    a.delvstatus,a.issplace,a.issdate,a.doe
                                     FROM `visatran` a   WHERE  a.passport = '$passport'") or die(mysqli_error($conn));
$mname = mysqli_fetch_array($qry);

$gcourr = mysqli_query($conn, "SELECT visano FROM `visamain` WHERE `myvouch` = '$mname[myvouch]'");
$gtpt = mysqli_fetch_array($gcourr);

$ctr2 = 0;
//$pctr2 = 1;
$success = true;
     
         $rows = array('success' => $success,
            'passrecd' => $mname['passrecd'],
            'meddate' => $mname['vouchdt'],
            'fitdate' => $mname['fitdate'],
            'mofa_date' => $mname['mofa_date'],
            'stampdate' => $mname['stampdate'],
            'paxname' => $mname['paxname'],
            'broker' => $mname['broker'],
            'mofano' => $mname['mofano'],
            'visano' => $gtpt['visano'],
            'delvstatus' => $mname['delvstatus'],
            'issplace' => $mname['issplace'],
            'issdate' => $mname['issdate'],
            'doe' => $mname['doe'],
            'passdeliver' => $mname['passdeliver'],
            
        );

$ctr2++;

header("Content-type: application/json");
echo json_encode($rows);
 }
?>