<?php
if(isset($_COOKIE['ADMIN'])) {
	require('main.php');
	exit;
}
else {
	if(isset($_POST['login'])) {
		$username=addslashes($_POST['username']);
		$password=addslashes($_POST['password']);
		if(($username == "admin") && ($password =="#8X@Y7jV")) {
			setcookie("ADMIN","YES",0,"/");
			header("Location: ./");
		}
		else {
			$error_msg="Invalid username or password";
		}
	}
}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Administrator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="css/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<p>&nbsp;</p>
<table width="320" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="314" height="21" bgcolor="#de0011" class="headers">Admin Login</td>
  </tr>
  <tr>
    <td><form name="form1" method="post" action="">
      <table width="100%" border="0" cellspacing="1">
	  	<tr>
          <td colspan="2" bgcolor="#E8FFF8" class="error_msg"><?php echo $error_msg; ?></td>
        </tr>
        <tr>
          <td width="26%" bgcolor="#E8FFF8">Username</td>
          <td width="74%" bgcolor="#E8FFF8"><input name="username" type="text" id="username"></td>
        </tr>
        <tr>
          <td bgcolor="#E8FFF8">Password</td>
          <td bgcolor="#E8FFF8"><input name="password" type="password" id="password" value=""></td>
        </tr>
        <tr>
          <td bgcolor="#E8FFF8">&nbsp;</td>
          <td bgcolor="#E8FFF8"><input name="login" type="submit" id="login" value="Login"></td>
        </tr>
      </table>
        </form>
    </td>
  </tr>
</table>


</body>
</html>
