Specifications
LISTING 24.11 member.php—This Script is the Main Hub of the Application
<?
// include function files for this application
require_once(“bookmark_fns.php”);
session_start();
if ($username && $passwd)
// they have just tried logging in
{
if (login($username, $passwd))
{
// if they are in the database register the user id
$valid_user = $username;
session_register(“valid_user”);
}
else
{
// unsuccessful login
do_html_header(“Problem:”);
echo “You could not be logged in.
You must be logged in to view this page.”;
do_html_url(“login.php”, “Login”);
do_html_footer();
exit;
}
}
do_html_header(“Home”);
check_valid_user();
// get the bookmarks this user has saved
if ($url_array = get_user_urls($valid_user));
display_user_urls($url_array);
// give menu of options
display_user_menu();
do_html_footer();
?>
You might recognize the logic in this script: we are re-using some of the ideas from
Chapter 20.
Building Practical PHP and MySQL Projects
P
ART V
514
30 7842 ch24 3/6/01 3:34 PM Page 514










