13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Implementing User Functions<br />

719<br />

Changing Account Settings<br />

The Account Settings button, when clicked, activates the account-settings action.The<br />

code for this action is as follows:<br />

case 'account-settings':<br />

display_account_form(get_email(),<br />

get_real_name(get_email()), get_mimetype(get_email()));<br />

break;<br />

As you can see, you reuse the display_account_form() function used to create the<br />

account in the first place. However, this time you pass in the user’s current details, which<br />

will be displayed in the form for easy editing.When the user clicks on the submit button<br />

in this form, the store-account action is activated as discussed previously.<br />

Changing Passwords<br />

Clicking on the Change Password button activates the change-password action, which<br />

triggers the following code:<br />

case 'change-password':<br />

display_password_form();<br />

break;<br />

The display_password_form() function (from the output_fns.php library) simply displays<br />

a form for the user to change his password.This form is shown in Figure 30.9.<br />

Figure 30.9<br />

The display_password_form() function enables users to<br />

change their passwords.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!