<?php 
/**  * Creates Unsynced rows data as JSON  */    
include_once 'db_functions.php';     
$db = new DB_Functions(); 
$ei = $_REQUEST[eid]; 
$password=$_REQUEST[password];   

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

   $row = mysql_fetch_array($users);
   $numrow= mysql_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
			   if($row["utype"]==7){
				$b["uid"]=$row["uid"];
				$b["username"] = $row["username"];
				$b["owner_code"] = $row["owner_code"];
				$b["name"] =$row["name"]; 
				$b["utype"]= $row["utype"];
				$b["phone"]= $row["phone"];
				$b["email"]=$row["emailid"];
			   }else{
				   $b["error"] = "User id is not found in sales executive data";
			   }
		   }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);    
?>