3. Fill in the relevant code to create the solution and meet the requirements Solution
Based on thep provided template create a web application that completes the following workflow:
1. The user starts at the login page.
2. The user logs in and their password is verified against the database. If the login is successfull a new session is started and the users details are copied to the session.
3. The user is redirected to the welcome page and their details are displayed.
inc/config.inc.php Database configuration information inc/Utility/PDOAgent.class.php PDO Wrapper Class inc/Utility/Page.class.php Page Class inc/Utility/UserMapper.class.php Static User Mapper responsible for CRUD operations inc/Entities/User.class.php User Entity with getters and setters. inc/Utility/LoginManager.class.php LoginManager responsible for checking if a user is logged in 4. When the user selects to log off, they are redirected to a page that wishes them good bye. There session is terminated and then after 10 seconds redirects them to the main page.
You must utilize the database provided in the sql directory. You must use password_verify and password_hash to verify the username and password stored in the database. The passwords are all set to the same value of respective usernames.
Requirements 1. You must use a database called "Lab09", your username should be 'root' and your password should be '' just like the lab computers.
2. You must use the PDO class we created based on the template provided.
3. You muse use a User class to map the user details
4. You must use a UserMapper class to get information from the database 5. You must use the LoginManager static class to verify the login
6. You must store if the user is logged in in a session.
Structure FileName Description
FileName Description
inc/Utility/Validation.class.php Responsible for Validating user input Lab08_SWh-56789-login.php This file displays the login page to the user and processes logins. Lab08_SWh-56789-welcome.php This page welcomes the user, it should not be visisble if the user has not provided a proper login Lab08_SWh-56789-logout.php This file displays the logout page to the user and redirects them after 10 seconds to the login page. sql/Lab09.sql User database with accounts
Hints:
Use header() to redirect between pages
You can use the META REFRESH tag to redirect with a delay session_destory() doesnt actually work well, you should unset() the session
Use your browsers "In Private" or "Incognito Mode" to test the effects of different sessions.