<?php
class Verify extends MY_Controller {
    function __construct() {
        parent::__construct(); 
    }
    function do() {
        if ($this->isLogin === false ) {
            echo json_encode(
                array(
                    "status" => "Error",
                    "message" => "Unauthorized User"
                ));
            exit; 
        }
        $userID = $this->sys_user["M_UserID"];
        $sql = "select count(*) total from m_user where M_UserID = ? and M_UserIsActive = 'Y'";
        $qry = $this->db->query($sql,[$userID]);
        if (!$qry) {
            echo json_encode(
                array(
                    "status" => "ERR",
                    "message" => "Error " . $this->db->error()['message']
                )
            );
            exit;
        }
        $rows = $qry->result_array();
        if(count($rows) == 0) {
            echo json_encode(
                array(
                    "status" => "ERR",
                    "message" => "Invalid User"
                )
            );
            exit;
        }
        echo json_encode(
            array(
                "status" => "OK",
                "message" => "Invalid User"
            )
        );

    }
}
?>
