<?php
session_start();
include "../functions.php";
include ("../sanitize.php");
sanitizeit();

$userID = checkAdmin(session_id());

//echo "<$userID>";
//include "adminHeader.php";

$query = "select firstName, lastName, manager from theusers where userID='$userID'";
$result = mysql_query($query);

while ($row = mysql_fetch_array($result))
{
	$firstName = $row[0];
	$lastName = $row[1];
	$manager = $row[2];
}


//include "adminFooter.php";
?>

<html>
<head>
<title>Administration Area</title>
</head>

<body>

<center>
<table width=80% border=0>
  <tr>
    <td width=1>
     <img src="../img/logo.jpg">
    </td>
    
    <td valign="bottom">
      <table border=0 width=100% height=100% cellpadding=13>
        <tr>
          <td align="center"><h2><b>Administration Module</b></h2></td>
        </tr>
        
        <tr>
          <td align="center"><a href="logoff.php">Log out</a>&nbsp;&nbsp;&nbsp;
          <?php
          if ($manager == 0)
          {
          	?>
          	<a href="administrators.php">Manage Admin Users</a></td>
          	<?php
        }
        else
        {
        	?>
        	<a href="modAdmin.php" onclick="form1.submit();return false;">Modify Profile</a>
        	<table><tr><td><form action=modAdmin.php method="post" name=form1>
        	<input type="hidden" name="userID" value="<?php echo $userID ?>">
        	</td></form></tr></table>
        	<?php
        }
        ?>
        
        </tr>
      </table>
    </td>
    
    <td align="right" valign="bottom">
      <?php echo "<b>Welcome! $firstName, $lastName</b>"; ?>
    </td>
    
  </tr>
</table>
</center>

<center>

<table width=80% border=0 cellpadding=10 cellspacing=1>
<?php
if ($manager == 0)
{
?>
<tr bgcolor="#a0a0a0"><th width=30%>Module</th><th width=70%>Description</th></tr>
<tr bgcolor="#e9e9e9"><td align="center"><a href="../events/index.php">Events</a></td><td>To update company events</td></tr>
<tr bgcolor="#c9c9c9"><td align="center"><a href="../products/products.php">Products</a></td><td>To manage the products</td></tr>
<tr bgcolor="#e9e9e9"><td align="center"><a href="../press/press.php">Press & Release</a></td><td>To manage photos</td></tr>
<?php
}
else
{
?>
<tr bgcolor="#a0a0a0"><th width=30%>Module</th><th width=70%>Description</th></tr>
<tr bgcolor="#e9e9e9"><td align="center"><a href="../job/job.php">Jobs</a></td><td>To add new job postings, view job application statics </td></tr>
<tr bgcolor="#c9c9c9"><td align="center"><a href="../staff/staff.php">Staff</ta></td><td>To manage staff accounts and view staff movement</td></tr>
<tr bgcolor="#e9e9e9"><td align="center"><a href="f.php">Facilities</a></td><td>rooms</td></tr>
	<?php
}
?>
</table>
</center>

</body>
</html>