<?php

//echo "In php";
include 'db_connector.php';
include 'login_qr.php';
include 'oprt_session.php';
//echo "oprt_session included";
//echo "afcddfvdfv";
$data = json_decode(file_get_contents("php://input"));
$choice = $data->choice;
//echo "Choice ".$choice;
switch ($choice) {
    case "isValidate":
        //echo "In isValidate ";
        $obj = new db_connector();
        $log = new login_qr();
        $sess = new oprt_session();
        $u_name = mysqli_real_escape_string($obj->reCon(), $data->_user);
        $u_pass = mysqli_real_escape_string($obj->reCon(), $data->_key);
        //echo $u_pass."uname ".$u_name;
        $dt = array('u_name' => $u_name, 'u_pass' => $u_pass);
        $query = $log->loginAdaptor("isValidate", $dt);
        //echo $query;
        $result = $obj->query_db($query);
        if (mysqli_num_rows($result) == 1) {
            //echo "Hiii";
            $name;
            $queryName = $log->loginAdaptor("fetchUser", $dt);
            $resultName = $obj->query_db($queryName);
            while ($rw = $resultName->fetch_assoc()) {
                $name = $rw['emp_name'];
function printCall($query)
{
    $obj = new db_connector();
    $result = $obj->query_db($query);
    $data = array();
    if ($result->num_rows > 0) {
        while ($row = $result->fetch_assoc()) {
            $call_ddmmyy = $row["call_dd"] . '/' . $row["call_mm"] . '/' . $row["call_yy"];
            array_push($data, array('call_id' => $row["call_id"], 'usr_name' => $row["usr_name"], 'call_ddmmyy' => $call_ddmmyy, 'call_bankNm' => $row["bank_name"], 'callDetails' => $row["call_particulars"], 'mngr_call_remark' => $row["mngr_call_remark"], 'admn_call_remark' => $row["admn_call_remark"], 'call_fullDt' => $row["call_fullDt"], 'isCallSunday' => $row["isCallSunday"], 'isCallOutstation' => $row["isCallOutstation"]));
        }
        echo json_encode($data);
    } else {
        $err = array('error' => "not found");
        echo json_encode($err);
    }
}