Specifications

FIGURE 28.9
The display_password_form() function enables users to change their passwords.
When a user clicks on the Change Password button at the bottom of this form, the
store-change-password action will be activated. The code for this is as follows:
case ‘store-change-password’ :
{
if(change_password(get_email(), $old_passwd,
$new_passwd, $new_passwd2))
{
echo “<p>OK: Password changed.<br><br><br><br><br><br>”;
}
else
{
echo “<p>Sorry, your password could not be changed.”;
display_password_form();
}
break;
}
As you can see, this code tries to change the password using the change_password() function
and reports success or failure to the user. The
change_password() function can be found in the
user_auth_fns.php function library. The code for this function is shown in Listing 28.12.
Building Practical PHP and MySQL Projects
P
ART V
690
34 7842 CH28 3/6/01 3:46 PM Page 690