O'Reilly logo

Programming with CodeIgniter MVC by Yehuda Zadik, Eli Orr

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example 3 – admin and regular user log in

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required