Learn how to define a PHP class to manage the code's interaction with the SESSION storage and to handle the code that remembers if an admin is currently logged in or not.
- [Instructor] In this movie,…we're going to define a new class called session.…And we're going to use it to help us manage our php sessions.…We're mostly going to use it so that we can keep track…of whether a user is logged in in the session or not.…Let's remember that the way that we're keeping track…of a user being logged in,…is that we're going to store their id in the session.…So for example, we have a function called log_in.…We pass in an id, and it sets a variable in the session…and then we can keep track of that variable…from then on.…
On all subsequent page loads, we can check that variable…and see if it's been set, we know the user is logged in.…So we have another function called is_logged_in…that will report back whether it's set or not.…And then when we want the user to log out,…we simply unset that variable.…So that variable acts like a hand stamp,…letting us know on each of the subsequent page requests…after logging in, we know this user is already logged in…and we don't need to ask them to log in again.…
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.