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

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

$success = false;

if (isset($_REQUEST["mobile"])) {
    $mobile = $_REQUEST['mobile'];

    $query = "SELECT * FROM `pax` WHERE mobile ='$mobile'";
    $result = mysqli_query($conn, $query) or die(mysqli_error($conn));
    $r = mysqli_fetch_assoc($result);


    $rows = array();
    $ctr = 0;
    $rows = array(
        'success' => true,

        'suffix'      =>   "$r[suffix]",
        'surname'     =>   "$r[surname]",
        'name'        =>   "$r[name]",
        'midname'     =>   "$r[midname]",
        'gender'     =>   "$r[gender]",
        'aadhaarno'   =>   "$r[aadhaarno]",
        'panno'       =>   "$r[panno]",
        'address'     =>   "$r[address]",
        'city'        =>   "$r[city]",
        'pin'         =>   "$r[pin]",
        'state'       =>   "$r[pstate]",
        'statecode'   =>   "$r[pstatecode]",
        'email'       =>   "$r[email]",
        'gstno'       =>   "$r[gstno]"
    );


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