In this example we will see how the controller can coordinate using models and views a login session for a regular user, as well as an admin super user, so that each will have a distinct menu. In order to use the provided database file and successfully log in, use the following steps:
For regular user login:
User:
reg_user
Password:
111111111
(9 x 1 s)
For admin user login:
User:
admin_user
Password:
111111111
(9 x 1 s)
This example will be constructed from the following controller, models, and views:
application/controller/auth.php
: This controller is used to control authentication checkup and redirect each user category to its view or notify of a login failure. Regular users and admin users will have different view menu, message, and logout options.application/models/users_model.php
: This is the model to validate the submitted user name and password (stored in the database via MD5) against the predefined database table of users.application/views/login_view...