Specifications

LISTING 28.2 Continued
$status = ‘’;
// need to process log in or out requests before anything else
if($email&&$password)
{
$login = login($email, $password);
if($login == ‘admin’)
{
$status .= “<p><b>”.get_real_name($email).”</b> logged in”
.” successfully as <b>Administrator</b><br><br><br><br><br>”;
$admin_user = $email;
session_register(“admin_user”);
}
else if($login == ‘normal’)
{
$status .= “<p><b>”.get_real_name($email).”</b> logged in”
.” successfully.<br><br>”;
$normal_user = $email;
session_register(“normal_user”);
}
else
{
$status .= “<p>Sorry, we could not log you in with that
email address and password.<br>”;
}
}
if($action == ‘log-out’)
{
session_destroy();
unset($action);
unset($normal_user);
unset($admin_user);
}
/**********************************************************************
* Section 2: set up and display headers
*********************************************************************/
// set the buttons that will be on the tool bar
if(check_normal_user())
{
// if a normal user
Building Practical PHP and MySQL Projects
P
ART V
664
34 7842 CH28 3/6/01 3:46 PM Page 664