Join David Powers for an in-depth discussion in this video Setting the session handler, part of PHP: Managing Persistent Sessions.
- We can use the simple session example from Chapter One…to test the MySQL session handler class.…All the files that you need are in the Chapter Three…03_06 folder of the Exercise files.…Inside there is a folder called Foundationphp…with a subfolder called Sessions…and then in there is the MysqlSessionHandler…class definition.…The includes folder has this file db_connect.php,…This is the same as the file used to test the database…connection in Chapter Two,…but the code that confirms connection has been removed.…
The three session files are the same as before…with one small addition to session_03.php.…Instead of a link to page one, we now have a form…with a Log Out button.…We don't need to make any changes to session_01.php…so let's get to work on number 02, session_02.php.…Before calling session_start on line 3…we need to add some extra code to connect…to the database and to tell php to use MysqlSessionHandler.…
So, let's just add in a little bit of extra space…after the opening php tag.…And, the SessionHandler class is in the name space…
- Configuring sessions
- Inspecting how session data is stored
- Implementing persistent sessions
- Creating a SQL database to store session data
- Implementing the PHP SessionHandlerInterface
- Writing session data
- Closing and destroying sessions
- Creating an auto-login system with persistent sessions
- Creating persistent logins
- Checking out visitor credentials
- Authenticating users
- Logging out users selectively
Skill Level Intermediate
PHP: Accessing Databases with PDO and MySQLiwith David Powers3h 47m Intermediate
1. Sessions and Security
2. Preparing the Database
Connecting to the database5m 49s
3. Storing Session Data in MySQL
4. Creating an Autologin System
5. Testing the Autologin System
Final thoughts3m 9s
- 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.