Join David Powers for an in-depth discussion in this video Logging out selectively, part of Managing PHP Persistent Sessions.
- In the previous video we logged out the user automatically…if the wrong username and password…were entered multiple times in the form, asking users…to confirm their identity.…However we also need a way for users to logout normally.…So let's see the code for that.…Each of the restricted pages, includes this file,…logout_button.php.…It contains an html form with a logout button…and on line three we create a session variable called…return_to, and set it's value to SERVER[ "PHP_SELF"]…in other words, the current URL.…
And this is in case the user of a persistent session…decides to cancel the logout process.…So we'll know where to return the user to…when they click cancel.…The forms action is set to logout.php…and the method is post.…logout.php is here.…And this contains a form with php blocks above the doc type…and also below the closing html tag.…Let's begin by looking at the form.…
The action is set to SERVER[ "PHP_SELF"]…in other words, the page will reload when one of…the submit buttons is clicked,…and it uses the post method.…
- 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
Accessing Databases with Object-Oriented PHPwith 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.