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

$user=$_SESSION['company'];
//echo "admin success!!!";
				
?>
<html>
<head>
<link href="header.css" rel="stylesheet" type="text/css"/>
<link type="text/css" rel="stylesheet" href="overflow.css" />
<script type="text/javascript" src="jquery.js"></script>
</head>
<body>
<!---------------------------------Login History----------------------------------->
<div class="headPass"><h3 class="password">Login History</h3></div>
<?php
	//set pages per items
	$per_page = 10;
	
	$query1=mysql_query("SELECT * from loginreport where user='$user'");

	$total=ceil(mysql_num_rows($query1)/$per_page);

	$page =(isset($_GET['page'])) ? (int) $_GET['page'] :1;
	$start=($page-1)*$per_page;
	//echo $page;

	//display pages
	/*echo "<form>";
	echo "<table align=center width='100%'>";
	echo "<tr class=page><td width='10%'>Pages >></td><td>";
	//while loop page
	while($i<=$total){
		echo "<a href='loginRecord.php?page=$i&user=$user#' align=center id='b'>$i</a>&nbsp ";
		$i++;
	}
	echo "</td></tr>";
	echo "</table>";
	echo "</form>";
	*/
	echo "<br/>";
?>	
	<table align=center width=100% cellspacing=3 cellpadding=8>
		<tr class=menu>
			<th>No.</th>
			<th>Login Time</th>
			<th>Login IP address</th>
			</tr>
<?php
	//load company info	
	$query=mysql_query("select * from loginreport where user='Admin' order by recordID desc limit $start,$per_page");
	$i=1;
	while($display=mysql_fetch_array($query)){
		
	$idid=$display['recordID'];
	$date=$display['date'];
	$time=$display['time'];
	$ip=$display['ip'];
	
	date_default_timezone_set ("Singapore"); 
	$ldate=date("d/m/Y", time());
	
	echo "<tr class=menu2>";
	echo "<td align=center>".$i."</td>";
	echo "<td align=center>".$date."&nbsp;&nbsp;&nbsp;".$time."</td>";
	echo "<td align=center>".$ip."</td>";
	echo "</tr>";
	
	$i++;
	}
	
	?>	
	</table> 
<!-------------------End login------------------------>




</body>
</html>