<?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();
	$newResponse1 = array();
	
	$result="0";
	
   if(mysqli_num_rows($re) > 0)
   {
		 while($rt = mysqli_fetch_assoc($re))
		 {
				$result="1";
				
				$cmpmid = $rt['companymid'];
				$umid = $rt['usermid'];
				
				
				
				// $eve1 = "select * from res_trolley_master where trolleyaddedby=$umid order by trolleyupdatedon desc";
				 $eve1 = "select * from res_trolley_master order by trolleyupdatedon desc";
				
				 $re1 = mysqli_query($conn, $eve1);
				 if(mysqli_num_rows($re1) > 0)
				   {
						 while($rt1 = mysqli_fetch_assoc($re1))
						 {
							 $trolleymid = $rt1['trolleymid'];
							 $trolleyno = $rt1['trolleynumber'];
							 $trolleyqrcode = $rt1['trolleyqrcode'];
							 $trolleytareweight = $rt1['trolleytareweight'];
							 $trolleycolor = $rt1['trolleycolor'];
							 $updatedon = date("d-m-Y H:i:s",strtotime($rt1['trolleyupdatedon']));
							
							 
							 $result="1";
							 
							  
								$posts[] = array('result'=> $result,'msg'=> 'Success','trolleyid'=>$trolleymid,'trolleyno'=>  $trolleyno,'trolleyweight'=>  $trolleytareweight,'lastupdatedon'=>$updatedon,'tcolor'=>$trolleycolor);

						}
				   }  
				   else
						{
							$result="0";
							$msg="Failure";
							
							$posts[] = array('result'=> $result,'msg'=> $msg);
					
						}
			
		 }
		
	
		$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,'msg'=> $msg);
		$response['posts'] = $posts;
		echo stripslashes(json_encode( array('item' => $posts)));
   }
   
	mysqli_close($conn);
	
	
?>