Learn how to make improvements to the Session class so that it can keep track of the current admin's username and the time of their last login.
- [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 expire.…So let's add those two features in.…
Note: This is an intermediate-level training course that assumes you have existing knowledge of PHP. To refresh your skills, check out PHP Essential Training and PHP: Object-Oriented Programming.
- Creating a project database and tables
- Connecting to the database
- Database queries with OOP
- The active record design pattern
- Defining a database-driven class
- Performing common database tasks with OOP
- Creating inheritable and reusable code
- Object-oriented user authentication
- Object-oriented pagination
Skill Level Intermediate
Consuming RESTful APIs in PHP with Guzzlewith Justin Yost2h 12m Intermediate
PHP: Accessing Databases with PDO and MySQLiwith David Powers3h 47m Intermediate
1. Overview and Project Setup
2. The Database Connection
3. Define a Database-Driven Class
4. Object-Oriented CRUD
5. Object-Oriented Authentication
6. Object-Oriented Pagination
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.