From the course: PHP: Object-Oriented Programming with Databases
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Improve the session class - PHP Tutorial
From the course: PHP: Object-Oriented Programming with Databases
Improve the session class
- [Instructor] Before we leave this topic completely, I want us to make a few improvements to our session class. Hopefully this will help to illustrate why it's useful to wrap up some of that session functionality into a class in the first place. Putting all of that code into the session class allowed us to have it all in one place, but it also allows us to be able to extend this class and to do more work on it in the future, so it would become more complex over time and helps us to manage that complexity. For example, let's say that we wanted to have the current user's username displayed up here at the top, so it would just say who you're logged in as. Well, we could add that feature by simply adding a new public attribute for username. Let's say that we also wanted to keep track of when the user last logged in. We'll make a private attribute for their last_login. The idea might be that we don't want to allow users to stay logged in forever. At a certain point, we want their login to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Admin class7m 40s
-
Hashing passwords7m
-
(Locked)
Admin validations7m 16s
-
(Locked)
Find by username5m 55s
-
(Locked)
Verify password5m 5s
-
(Locked)
Define a session class8m 34s
-
(Locked)
Add page access control4m 52s
-
(Locked)
Improve the session class7m 39s
-
(Locked)
Session messages6m 40s
-
(Locked)
-
-