Specifications
}
// check password length is ok
// ok if username truncates, but passwords will get
// munged if they are too long.
if (strlen($passwd)<6 || strlen($passwd) >16)
{
do_html_header(“Problem:”);
echo “Your password must be between 6 and 16 characters.”
.”Please go back and try again.”;
do_html_footer();
exit;
}
// attempt to register
$reg_result = register($username, $email, $passwd);
if ($reg_result == “true”)
{
// register session variable
$valid_user = $username;
session_register(“valid_user”);
// provide link to members page
do_html_header(“Registration successful”);
echo “Your registration was successful. Go to the members page “
.”to start setting up your bookmarks!”;
do_HTML_URL(“member.php”, “Go to members page”);
}
else
{
// otherwise provide link back, tell them to try again
do_html_header(“Problem:”);
echo $reg_result;
do_html_footer();
exit;
}
// end page
do_html_footer();
?>
Building User Authentication and Personalization
C
HAPTER 24
24
AUTHENTICATION
AND
PERSONALIZATION
509
LISTING 24.6 Continued
30 7842 ch24 3/6/01 3:34 PM Page 509










