<?php

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

$maindb = 'courin';

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);

$passport = $_REQUEST["passport"];


if (isset($_REQUEST["passport"])) {
    
    $passport = $_REQUEST['passport'];
    
    $query2 = "SELECT * FROM `$maindb` WHERE passport ='$passport'";
    $result2 = mysqli_query($conn, $query2) or die(mysqli_error($conn));
    $r2 = mysqli_fetch_assoc($result2);
    
    

    $rows = array();
    $ctr = 0;
    $rows = array('success' => true,
        'paxname'  => "$r2[paxname]",
        'medical'  => "$r2[medical]",
        'license'   => "$r2[license]",
        'photo' => "$r2[photo]",
        'oldpass'   => "$r2[oldpass]");

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