<?php
//session
session_start();
include ("connect.php");
$username = $_SESSION['staff'];

if($_SESSION['staff']!= null)
{
?>

<html>
<head>
<title>Daily Bookstore - Management System</title>
<!--include css file-->
<link href="bookstaff.css" rel="stylesheet" type="text/css"/>

<!--form validation java script-->
<script type="text/javascript">
function validate_form()
{
	valid=true;
	
	if((document.loginForm.staffID.value=="")||(document.loginForm.staffPassword.value==""))
	{alert("Please fill your login details.");
		valid=false;}
	
}
</script>

<!--clock function-->
<script type="text/javascript">
function init ( )
{
  timeDisplay = document.createTextNode ( "" );
  document.getElementById("clock").appendChild ( timeDisplay );
}

function updateClock ( )
{
  var currentTime = new Date ( );

  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );

  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;

  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";

  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;

  // Compose the string for display
  var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

  // Update the time display
  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}

// -->
</script>
</head>

<body onload="updateClock(); setInterval('updateClock()', 1000 )">

<table border="0" width="100%">

<tr>
<td><img src="Picture/Logo.gif"></td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>

<tr>
<td colspan="2"><h2>Daily Bookstore - Management System</h2></td>
<td align="right"><h3>Current Time:<span id="clock">&nbsp;</span></h3></td>
</tr>

<tr>
<td colspan="2"></td>
<td align="right" style="color:darkblue"><h3>You log in as:<span>
<?php
echo "<span style='color:black;font-weight:bold'>".$username."</span>";
?>
<a href="logout.php">(Logout)</a>
</h3>
</span>
</td>
</tr>

</table>
<table align="center" width="100%" border="0">
<tr>
<td>
<fieldset>
<legend><img src="Picture/gear.gif" width="40" height="40">Function List</legend>
<div class="toplink">
<?php
include ("stafffunction.php");
?>

<div id="mainpage">
<table align="center" width="70%" border="1">
<caption><img src="Picture/toolbox.gif"/>Daily Bookstore Management System - Home Page</caption>
<tr>
<th colspan="4">Welcome to Daily bookstore management system. This main page will guide you how to use this system.</th>
</tr>

<tr>
<td rowspan="2" width="20%"><a href="book.php"><img src="Picture/book.gif" width="35" height="35" alt="manage book"><br/><a href="book.php">Manage Book</a></td>
<td colspan="3">Search, view, add, delete and edit bookstore's book.</td>
</tr>

<tr>
<td width="26%"><a href="book.php">Manage Book</a></td>
<td width="26%"><a href="addbook.php">Add Book</a></td>
<td width="26%">&nbsp;</td>
</tr>

<tr>
<td rowspan="2"><a href="bill.php"><img src="Picture/bill.gif" width="35" height="35" alt="manage bill"><br/><a href="bill.php">Manage Bill</a></td>
<td colspan="3">Manage order from online bookstore, view and generate sales order and invoice.</td>
</tr>

<tr>
<td><a href="salesorderlist.php">Online Order</a></td>
<td><a href="salesorder.php">Sales Order</a></td>
<td><a href="invlist.php">Invoice</a></td>
</tr>

<tr>
<td rowspan="2"><a href="memlist.php"><img src="Picture/member.gif" width="35" height="35" alt="manage member"><br/><a href="memlist.php">Manage Member</a></td>
<td colspan="3">Approve new member, view and edit member information.</td>
</tr>

<tr>
<td><a href="newmem.php">Approve Member</a></td>
<td><a href="memlist.php">Manage Member</a></td>
<td>&nbsp;</td>
</tr>

<tr>
<td rowspan="2"><a href="viewmessage.php"><img src="Picture/message.gif" width="35" height="35" alt="Customer Comment"><br/><a href="viewmessage.php">Customer Comment</a></td>
<td colspan="3">View comment and message leave by customer.</td>
</tr>

<tr>
<td><a href="viewmessage.php">Customer Comment</a></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

<tr>
<td rowspan="2"><a href="event.php"><img src="Picture/event.gif" width="35" height="35" alt="manage event"><br/><a href="event.php">Manage Event</a></td>
<td colspan="3">Add, edit and delete bookstore's event and activity.</td>
</tr>

<tr>
<td><a href="event.php">Manage Event</a></td>
<td><a href="addEvent.php">Add Event</a></td>
<td>&nbsp;</td>
</tr>

<tr>
<td rowspan="2"><a href="stafflist.php"><img src="Picture/admin.gif" width="35" height="35" alt="admin control"><br/><a href="stafflist.php">Admin Control</a></td>
<td colspan="3">Add and edit admin user that can login to this system.</td>
</tr>

<tr>
<td><a href="stafflist.php">Admin Control</a></td>
<td><a href="addstaff.php">Add Admin</a></td>
<td>&nbsp;</td>
</tr>

<tr>
<td rowspan="2"><a href="customerInformation.php"><img src="Picture/list.gif" width="35" height="35" alt="manage customer"><br/><a href="customerInformation.php">Manage Customer</a></td>
<td colspan="3">Add, edit and delete bookstore's customer information.</td>
</tr>

<tr>
<td><a href="customerInformation.php">Customer List</a></td>
<td><a href="customer.php">Add Customer</a></td>
<td>&nbsp;</td>
</tr>
</table>
</div>
<hr/>

<center>
<div id="bottom">
<br/>
Copyright &#169; with Tian Tian Bookstore 2011. All Rights Reserved.
<br/>
Website:<a href="../bookstore" target="_blank">www.dailybook.com.my
</div>
</center>

</body>
</html>

<?php
}
else
{
	echo "<script language='javascript'>alert ('Only authorised user can visit this page!')</script>";
	echo "<script language='javascript'>window.location='index.php'</script>";
}
?>