<?php
session_start();
include "../functions.php";
if ($_POST["confirm"] == 1)
{
	$userID = $_POST["userID"];
	$query = "delete from theusers where userID='$userID'";
	mysql_query($query) or die (mysql_error());
	header ("location: administrators.php");
}

$userID = checkAdmin(session_id());

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

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

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


//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;
          <a href="index.php">Main Menu</a></td>
        </tr>
      </table>
    </td>
    
    <td align="right" valign="bottom">
      <?php echo "<b>Welcome! $firstName, $lastName</b>"; ?>
    </td>
    
  </tr>
</table>
</center>


<?php
$userID = $_POST["userID"];
$query = "select userName from theusers where userID='$userID'";

$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);

//print_r($row);
?>

<center>
<table width=80%>
<tr>
  <td align="center">
  Are you sure you want to delte Admin user: <b><?php echo $row[0]; ?></b>
  </td>
</tr>
<tr>
  <td align="center">
    <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
    <input type="hidden" name="userID" value="<?php echo $userID; ?>">
    <input type="hidden" name="confirm" value=1>
    <input type="submit" name="submit" value="Yes">
  </td></form>
</tr>
<tr>
  <td align="center">
    <form action="administrators.php">
    <input type="submit" value=" No ">
  </td></form>
</tr>
</table>
</center>

</body>
</html>