Specifications

FIGURE 24.8
The forgot_form.php script supplies a form in which users can ask to have their passwords reset and sent to
them.
LISTING 24.17 forgot_passwd.phpThis Script Resets a Users Password to a Random
Value and Emails Her the New One
<?
require_once(“bookmark_fns.php”);
do_html_header(“Resetting password”);
if ($password=reset_password($username))
{
if (notify_password($username, $password))
echo “Your new password has been sent to your email address.”;
else
echo “Your password could not be mailed to you.”
.” Try pressing refresh.”;
}
else
echo “Your password could not be reset - please try again later.”;
do_html_url(“login.php”, “Login”);
do_html_footer();
?>
Building Practical PHP and MySQL Projects
P
ART V
522
30 7842 ch24 3/6/01 3:34 PM Page 522