Specifications

LISTING 28.3 Continued
if (session_is_registered(“normal_user”))
return true;
else
return false;
}
function check_admin_user()
// see if somebody is logged in and notify them if not
{
global $admin_user;
if (session_is_registered(“admin_user”))
return true;
else
return false;
}
function check_logged_in()
{
return ( check_normal_user() || check_admin_user() );
}
As you can see, these functions use the session variables $normal_user and $admin_user to
check whether a user has logged in. Well talk about setting these session variables up in a
minute.
In the final section of the script, we send an HTML footer using the
do_html_footer()
function from output_fns.php.
Lets look briefly at an overview of the possible actions in the system. These actions are shown
in Table 28.2
TABLE 28.2 Possible Actions in the Mailing List Manager Application
Action Usable By Description
log-in Anyone Gives a user a login
form
log-out Anyone Ends a session
new-account Anyone Creates a new account
for a user
store-account Anyone Stores account details
Building Practical PHP and MySQL Projects
P
ART V
670
34 7842 CH28 3/6/01 3:46 PM Page 670