<?php include('header.php'); ?>
<?php
$chickens_are_real = "duck";
$cows_are_real = "petrie";
if(isset($_POST['submit'])) {
if($_POST['admin'] == $chickens_are_real && $_POST['password'] == $cows_are_real){
$admin = $_POST['admin'];
$pass = $_POST['password'];
session_start();
$admin = addslashes($admin);
$pass = addslashes($pass);
$_SESSION['admin'] = $admin;
$_SESSION['password'] = $pass;
}
}
if($_POST['submit']){
if($_POST['admin'] == $chickens_are_real && $_POST['password'] == $cows_are_real){
session_start();
if(!isset($_SESSION['admin'])){
echo 'You are not <a href="/admin_login.php">logged in</a>.';
}
echo "The login name and password were correct. You may now access the following Admin Areas:<br /><ul><li><a href=\"/news/index.php?action=addnews129\">Adding News</a></li></ul>More items will be added at a later time...";
}
else{
echo "<center><h3>Error</h3></center>";
echo "<p>The login name or password was not correct.";
}
}
elseif($_GET['actn'] == "test"){
session_start();
$admin = $_SESSION['admin'];
$pass = $_SESSION['password'];
echo "$admin is your admin name.<br />\n";
echo "$pass is you password.";
}
else{
?>
<center><h3>Admin Login</h3>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" />
Admin:<br />
<input type="text" name="admin" /><br />
Password:<br />
<input type="password" name="password" /><br />
<input type="submit" value=" Submit " name="submit" />
<input type="hidden" value="submit" name="submit" />
</form>
</center>
<?php
}
?>
<?php include('footer.php'); ?>