<?php
/*
Fretsweb - A Frets on Fire chart server
Copyright (C) 2009, Daan Sprenkels
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once "common.php";
include_once "log.php";
if(isset($_GET['need']))
{
if($_GET['need'] == 'admin')
{
$info = 'You need an admin status to do this.';
}
elseif ($_GET['need'] == 'moderator')
{
$info = 'You need a moderator status to do this.';
}
}
session_start();
if(isset($_POST['login']))
{
if($_POST['password'] == $admin_passwd)
{
$_SESSION['in'] = 2; // Admin status
header("location: index.php");
clog("Admin logged in");
die();
}
if($_POST['password'] == $moderator_passwd)
{
$_SESSION['in'] = 1; // Admin status
header("location: index.php");
clog("Moderator logged in");
die();
}
else
{
$info = '<p class="info">Wrong password!</p>';
clog("Entered wrong password");
}
}
else
{
session_destroy();
}
?>
<html>
<head>
<title>Admin Login</title>
<link href="../css.php" rel="stylesheet" type="text/css" />
<link href="../images/favicon.png" rel="icon">
</head>
<body>
<center>
<h2>Admin Password</h2>
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
<?php if(isset($info)) echo '<p class="info" align="center">'.$info.'</p>'; ?>
<p><input type="password" name="password">
<input type="submit" name="login" value="Login"></p>
</form>
<p><a href="..">Click here to go back to the index.</a></p>
</center>
</body>
</html>