Learn how to log out users by removing their stored user authorization so that they must re-authenticate to regain acess.
- [Voiceover] Now that we've learned…how to authenticate a user and how to have pages…that require that authorization,…we need to learn how to remove the authorization…or to logout a user.…We already have a placeholder page for logging out,…logout.php, and we even have a link for it…at the top of our page,…but if we click that, it doesn't actually log us out.…We stay logged in because it's not removing the hand stamp,…that admin ID that we stored in the session.…It's just unsetting $_SESSION['username'],…which was just a convenience that we had earlier.…
So what I'm going to do is I'm going to switch…to auth_functions.php and right here…below log_in_admin, I'm going to add…a new function called log_out_admin.…It is also included in the exercise files…if you want to get it from there.…And it's going to do the exact opposite…of logging in the user.…It's going to unset all of those session IDs,…one for admin ID, last login, and username,…so it handles all the business of logging a user out.…I also have another optional choice here.…
- Creating a content management system
- Building dynamic content navigation
- Using context and function options for conditional behavior
- Hiding content from the public view
- Insecure direct object reference
- Allowing HTML in dynamic content
- Previewing content in the public context
- Working with cookies and sessions
- Storing status messages in the session
- Secure user authentication (login/logout)
- Regulating page access
- Nesting related resources
- Managing an ordered list automatically
Skill Level Beginner
PHP with MySQL Beyond the Basicswith Kevin Skoglund10h 26m Intermediate
MVC Frameworks for Building PHP Web Applicationswith Drew Falkman2h 57m Intermediate
1. Create a Content Management System
2. Build Dynamic Content Navigation
3. Use Context and Options
4. Cookies and Sessions
5. Regulate Page Access
6. Nesting Related Resources
Next steps1m 15s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.