<?php 
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
/**  * Creates Unsynced rows data as JSON  */    
include_once 'db_functions.php';     
$db = new DB_Functions(); 
$ei = $_REQUEST['loginId']; 
$password=$_REQUEST['loginPwd'];   

$users = $db->getUserDetails($ei,$password);     
$a = array();     
$b = array();

   $row = mysqli_fetch_array($users);
   $numrow= mysqli_num_rows($users);
   if($numrow > 0){
	   ////check password
	   if($row["password"] == $password){
		   ////// check id should be active or not
		   if($row["status"]=="active"){
			   ////check login only SE
	
				$b["uid"]=$row["loginid"];
				$b["username"] = $row["loginid"];
				$b["name"] =$row["empname"]; 
				$b["utype"]= $row["utype"];
				$b["phone"]= $row["phone"];
				$b["email"]=$row["email"];
				$b["shift_time"]="9:30";
				
			   
		   }else{
			   $b["error"] = "User id is deactivated";
		   }
	   }else{
		   $b["error"] = "Incorrect password";   
	   }
   }
   else{
	$b["error"] = "User id does not exist";   
   }
array_push($a,$b);
echo json_encode($a);    
?>