Add code to the top of each PHP page to require user authentication before granting access to the page.
- [Instructor] In the previous movie…we learned how to authenticate a user,…that is how they can login…with their user name and their password.…However, none of the pages that we have…require that authorization right now.…They all just let anyone view them who wants to.…What we need to do is add some code…that will check to see whether the user is…currently authenticated before…it lets them have the page…to require that they have the authorization.…To do this, I'm going to add a couple more functions…to our auth_functions.php that we added in the last movie.…
This code is included in the exercise files…if you want to get it from there.…I'm going to paste them in.…The first function is, is logged in,…and is logged in is just going to check and see…is the current user logged in?…The way it does that is it looks for that hand stamp,…that ID that we put into the session.…It checks to see if that value is set.…If it exists then we know the user is logged in.…It's in their session.…If not, then they're not logged in.…
- 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.