Join David Powers for an in-depth discussion in this video Using the exercise files, part of Managing PHP Persistent Sessions.
- View Offline
- If you're a member of the lynda.com online training library, you have access to the exercise files for this course. Download them from the course page and save them in a convenient place on your local computer. I've got them here on my desktop, so let's just open them. This README text file contains a reminder about the password compat library if your server is running PHP 5.4. There's also advice on how to enable display errors. All the exercise files are organized in folders, numbered after each chapter and inside are subfolders for the individual videos that require exercise files.
Because we're working with PHP, you'll need to copy all of these files to a testing server. I created a folder called Persistent in my testing serving folder root, so let's just switch to my editing program and here we are. This is the folder called Persistent. It's inside my HT docs folder, which is the server root. Let's just take a look at some of the subfolders in here. When changes are made to a file, there are two versions.
One showing the state of the file at the beginning of the video and the other one with underscore and appended to the file name shows how it looks at the end. Occasionally, I start with a blank file and when that happens, only the end version is provided. Some folders like this one, also have text files that contain snippets of code for copying and pasting into the main file. Chapters four and five work slightly differently. Let's just open Chapter four and the 04_04 folder.
This contains the definition of the auto login class. It's quite long, so I devote three videos to explaining how the code works. So, this file is used throughout the rest of the chapter. Chapter five is where we test the Persistent sessions. At the beginning of Chapter five, you need to copy the folder from the 05_01 folder. You need to copy this test folder into the testing server root and the classes folder contains the final versions of the class definitions.
If you follow along coding with me, these files will already have been copied to a folder structure in the testing site root, but they're also here if you need them and I'll explain how everything needs to be organized again at the beginning of chapter five. So, all should become clear by then.
- 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