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

	// mobile password 
	$par1=$_GET['mobile']; //username
	$par2=$_GET['password']; //password
	
	
	date_default_timezone_set("Asia/Singapore");
	$mdate= date('Y/m/d H:i:s');
	$mdate2= date('Y-m-d H:i:s');
	$mdate1= date('d-m-Y');
	
	
	
	
	 $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();
	$itemlist = array();
	$hotellist = array();
	
	$result="0";
	
   if(mysqli_num_rows($re) > 0)
   {
		 while($rt = mysqli_fetch_assoc($re))
		 {
				$result="1";
				
				$cmpmid = $rt['companymid'];
				$umid = $rt['usermid'];
				
				$eve111 = "select * from res_item_master";
				
				 $re111 = mysqli_query($conn, $eve111);
				 if(mysqli_num_rows($re111) > 0)
				   {
						 while($rt111 = mysqli_fetch_assoc($re111))
						 {
							 $itemmid=$rt111['itemmid'];
							 $itemname=$rt111['itemname'];
							 $itemdetail=$rt111['itemdetail'];
							 $itemunit=$rt111['itemunit'];
							 
							 $itemlist[] = array('itemid'=> $itemmid,'itemname'=>$itemname,'itemdetail'=>$itemdetail,'itemunit'=>$itemunit);
						 }
				   }
				
				
				 $eve1 = "select * from res_company_master where companytype='I-Wash'";
				
				 $re1 = mysqli_query($conn, $eve1);
				 if(mysqli_num_rows($re1) > 0)
				   {
						 while($rt1 = mysqli_fetch_assoc($re1))
						 {
							 $companymid = $rt1['companymid'];
							 $cmpname = $rt1['companyname'];
							 $result="1";
							$hotellist[] = array('hid'=>  $companymid,'hname'=>  $cmpname);
						 }
				   }
				   $posts[] = array('result'=> $result,'message'=> 'Success','hotellist'=>  $hotellist,'itemlist'=>  $itemlist);
				  
		 }
		$response['posts'] = $posts;
		echo stripslashes(json_encode( array('item' => $posts)));
		//echo stripslashes(json_encode( $posts));
		
   }
   else
   {
		$result="0";
		$msg="Invalid Error";
		
		$posts[] = array('result'=> $result,'message'=> $msg);
	
		$response['posts'] = $posts;
		echo stripslashes(json_encode( array('item' => $posts)));
   }
   
	mysqli_close($conn);
	
	
?>