forked from science-ation/science-ation

Use committee members for authorization Add auth required checks in all admin/config sections
62 lines
1.4 KiB
PHP
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();
|
|
?>
|