Professional Documents
Culture Documents
Assignment: Log in and Log Out Using CI Session Library
Assignment: Log in and Log Out Using CI Session Library
College / Department:
Assignment No. 3
Online Education
ASSIGNMENT Page 1 of 8
1
Course Code IT342
College / Department:
Assignment No. 3
Online Education
ASSIGNMENT Page 2 of 8
Placeholders was used to substitute labels. It provides hint that describes the expected value of an input.
Output:
Add the verify method on the Login Controller where it will be redirected when the form is submitted:
After the submitting the form, the inputs will be validated by the rule required and by the callback_check_user. If it
passed the validation, it will determine the user whether it is an Administrator or a Member.
2
Course Code IT342
College / Department:
Assignment No. 3
Online Education
ASSIGNMENT Page 3 of 8
3
Course Code IT342
College / Department:
Assignment No. 3
Online Education
ASSIGNMENT Page 4 of 8
4
Course Code IT342
College / Department:
Assignment No. 3
Online Education
ASSIGNMENT Page 5 of 8
The Home controller is where the user will be redirected if a successful login was made. We have two (2) Home
controllers: one for the administrator and one for the member. The only difference between the two Home controllers is
that the one for the Adminstrator is placed inside the ‘application/controllers/admin’ folder.
On the constructor method of our Home class, we created a condition that will redirect unauthorized users to the Login
controller. Also when an administrator tries to visit the Member’s Home controller, the Administrator will be redirected
to Administrator’s Home controller.
5
Course Code IT342
College / Department:
Assignment No. 3
Online Education
ASSIGNMENT Page 6 of 8
Similarly to the member’s Home controller, unauthorized users will be redirected to the Login controller and redirect a
member to his/her Home controller when he/she attempts to request the controller.
Aside from the two Home controllers, we also included two different home.php views: one is located inside the
‘application/views’ folder and the other one placed inside ‘application/admin/views’ folder. The member’s home view at
application/views/home.php:
Output:
Output:
6
Course Code IT342
College / Department:
Assignment No. 3
Online Education
ASSIGNMENT Page 7 of 8
Lastly, we should wisely log out when we log in our accounts. Logout is simple; Destroying the session is what it does
specifically unsetting our ‘islogged’ session variable.
7
Course Code IT342
College / Department:
Assignment No. 3
Online Education
ASSIGNMENT Page 8 of 8
Assignment: