<?php

$userId = $_REQUEST['userid'];
$tokenId = $_REQUEST['token'];
$imei = $_REQUEST['imei'];
//echo $userId.' '.$tokenId.' '.$imei;
//die();
if($userId != ''){ 
 include("header.php");
	$query = "SELECT * FROM tbl_users WHERE user_id = '$userId' AND status = 1 and '".gmdate('Y-m-d H:i:s')."' between date(from_date) and date(to_date) ";
	
	$res =mysql_query($query) or generateMSG("", "SQL : ".$query."<br> Error : ".mysql_error());
	if(mysql_num_rows($res)>0)
	{
		$row = mysql_fetch_array($res);
		$_SESSION["user_id"] = $row["user_id"];
		$_SESSION["user"] = $x_user;
		$_SESSION["lang"] = $x_lang;
                $_SESSION['imei'] = $imei;
		if($row["date_format"]!="")
			$_SESSION["date_format"] =$row["date_format"];
		else
			$_SESSION["date_format"]='d.m.Y';
		if($row["time_format"]!="")
			$_SESSION["time_format"] =$row["time_format"];
		else
			$_SESSION["time_format"]='h:i a';
			
		$_SESSION['timezone'] = $row['timezone'];
		$_SESSION['show_owners'] = $row['show_owners'];
		$_SESSION['show_divisions'] = $row['show_divisions'];
		
		//$res =mysql_query("update tbl_users set token_id = '".$tokenId."' where user_id = $userId") or generateMSG("", "SQL : ".$query."<br> Error : ".mysql_error());
		//$rs =mysql_query("insert into  pushnotification set user_id = '".$userId."', imei = '".$imei."', token_id = '".$tokenId."'") or generateMSG("", "SQL : ".$query."<br> Error : ".mysql_error());

		//generateMSG('', "./", true);
		// include("php/session.php");
	}
	else
	{
		include("php/session.php"); 
	}
}else{
	
	 include("header.php");
	 include("php/session.php"); 
}
 ?>
 <?php ?>
		<div data-role="content"><!-- style='padding:0px;'-->
				<div class="ui-body ui-body-d">
					<div data-role="fieldcontain">
						<ul data-role="listview" data-divider-theme="b" data-inset="true">
    						<li data-theme='c'><a href='list_view.php?cmd=all_users' data-transition='slide'><div class='ui-grid-a'><div class='ui-block-b'><?php echo $lang['All Users']; ?></div></div></a></li>
    						<li data-theme='c'><a href='list_view.php?cmd=all_group' data-transition='slide'><div class='ui-grid-a'><div class='ui-block-b'><?php echo $lang['All Group']; ?></div></div></a></li>
    						<li data-theme='c'><a href='list_view.php?cmd=all_zones' data-transition='slide'><div class='ui-grid-a'><div class='ui-block-b'><?php echo $lang['All Zones']; ?></div></div></a></li>
    						<li data-theme='c'><a href='list_view.php?cmd=all_area' data-transition='slide'><div class='ui-grid-a'><div class='ui-block-b'><?php echo $lang['All Areas']; ?></div></div></a></li>
    						<li data-theme='c'><a
href='list_view.php?cmd=all_landmark' data-transition='slide'><div class='ui-grid-a'><div class='ui-block-b'><?php echo $lang['All Landmark']; ?></div></div></a></li>
<?php if($_SESSION['show_owners'] == 1) { ?>
    						<li data-theme='c'><a href='list_view.php?cmd=all_owner' data-transition='slide'><div class='ui-grid-a'><div class='ui-block-b'><?php echo $lang['All Owners']; ?></div></div></a></li>
<?php } ?>
<?php if($_SESSION['show_divisions'] == 1) { ?>
    						<li data-theme='c'><a href='list_view.php?cmd=all_divisition' data-transition='slide'><div class='ui-grid-a'><div class='ui-block-b'><?php echo $lang['All Division']; ?></div></div></a></li>
<?php } ?>
					</div>
					
				</div><!-- /body-d -->
		</div>

<?php include("footer.php"); ?>
