science-ation/committee_login.php
james 3deae5e029 Implement authorizaiton for admin/config sections
Use committee members for authorization
Add auth required checks in all admin/config sections
2005-02-16 22:50:43 +00:00

62 lines
1.4 KiB
PHP

<?
require("common.inc.php");
if($_POST['action']=="login" )
{
if($_POST['pass'] && $_POST['email'])
{
$q=mysql_query("SELECT * FROM committees_members WHERE email='".$_POST['email']."' AND password='".$_POST['pass']."' AND deleted='N'");
if(mysql_num_rows($q)==1)
{
$r=mysql_fetch_object($q);
$_SESSION['email']=$r->email;
$_SESSION['committee_member_id']=$r->id;
send_header("Committee Login");
echo happy(i18n("Successfully logged in"));
echo i18n("Use the menu on the left to access the committee pages");
}
else
{
send_header("Committee Login");
echo error(i18n("Invalid Email/Password"));
}
}
else
{
send_header("Committee Login");
echo error(i18n("Email/Password missing"));
}
}
else if($_GET['action']=="logout")
{
unset($_SESSION['email']);
unset($_SESSION['committee_member_id']);
send_header("Committee Login");
echo notice(i18n("You have been successfully logged out"));
}
else
{
send_header("Committee Login");
?>
<form method="post" action="committee_login.php">
<input type="hidden" name="action" value="login" />
<table><tr><td>
<?=i18n("Email")?>:</td><td><input type="text" name="email" size="20" />
</td></tr>
<tr><td>
<?=i18n("Password")?>:</td><td><input type="password" size="20" name="pass" />
</td></tr>
<tr><td colspan=2>
<input type="submit" value="Login" />
</td></tr>
</table>
</form>
<?
}
send_footer();
?>