I need expand the PHP script I created to add more items to an address book application. So far, I've created the basic login screen which has been tested with a hard-coded username and password and presents a message whether access was granted or denied. Following are the requirements for the address book code
- Throw an exception when the user enters invalid login credentials instead of displaying a message
- Catch and handle the error thrown by the code
- Redirect the user back to the login screen and display a friendly error message stating that the credentials were incorrect
- On successful login, set a cookie that will remember the user's credentials for a specific period of time. Redirect the user to a "Home" page that greets the person by name
- If a user who is already logged in attempts to visit the login page, the person should be redirected to the "Home" page
- Include a "logout" button at the top of the "Home" page that will clear the cookie and redirect the user to the "login" page