<?php  
	//session_start(); 
	include("../connect.php");

	 
	$par1=$_GET['mobile'];//username
	$par2=$_GET['password'];//password
	
	
	
	
	 $eve = "select * from res_user_master where userloginid='$par1' and usersecurepasword='$par2' and userstatus='Active' and userdesignation='User' limit 0,1";
	$re = mysqli_query($conn, $eve);
	$response = array();
	$posts = array();
	$result=1;
   if(mysqli_num_rows($re) > 0)
   {
		 while($rt = mysqli_fetch_assoc($re))
		 {
				$result="1";
				$sname = $rt['username'];
				
				$umobile = $rt['usermobile'];
				$userdesignation = $rt['userdesignation'];
				$companymid = $rt['companymid'];
				
				$eve1 = "select * from res_company_master where companymid=$companymid";
				
				 $re1 = mysqli_query($conn, $eve1);
				 if(mysqli_num_rows($re1) > 0)
				   {
						 while($rt1 = mysqli_fetch_assoc($re1))
						 {
							 $companyname = $rt1['companyname'];
							 $companytype = $rt1['companytype'];
							 $companyprefix = $rt1['companyprefix'];
						 }
				   }
				  
					
				$appversion = "0";
				$applink = "";
				
				
				
				$result=1;
				$msg="Success";
		
				$posts[] = array('result'=> $result,'message'=>$msg,'uname'=> $sname,'userdesignation'=> $userdesignation,'mobileno'=>$umobile,'appversion'=>$appversion,'applink'=>$applink,'companymid'=>$companymid,'company_name'=>$companyname,'company_type'=>$companytype,'companyprefix'=>$companyprefix);
				//$posts = ["item" => $newResponse];
		 }
		
	
		$response['posts'] = $posts;
		echo stripslashes(json_encode( array('item' => $posts)));
		//echo stripslashes(json_encode( $posts));
   }
   else
   {
		$result=0;
		$msg="Failure";
		
		$posts[] = array('result'=> $result,'message'=> $msg);
	
		$response['posts'] = $posts;
		echo stripslashes(json_encode( array('item' => $posts)));
   }
   
	mysqli_close($conn);
	
	
?>