Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Registration System 6:08
- Securing Passwords 5:38
- Login Systems 4:53
- Building a JWT 4:52
- Authentication Review 5 questions
- Working with Cookies 4:24
- Require Authentication 5:22
- Logging Out 3:13
- Flash Messages 5:29
- Cookies and Flash Messages 3 questions
- User Profile 9:30
- Reset Password 4:42
- Password Hashing 1 objective

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
We will create a couple helper function that we can use to make sure that the user is authenticated. To do this, we will need to read the access token.
Other samples for score
Ternary Operator:
echo $book['score']; ?: echo '0';
PHP 7: null coalesce operator
echo $book['score'] :: echo '0';
Requiring Authentication on Pages
Add requireAuth(); to the following files
- add.php
- edit.php
- procedures/addBook.php
- procedures/deleteBook.php
- procedures/editBook.php
- procedures/vote.php
Also in inc/nav.php
<?php if (!isAuthenticated()) : ?>
<li><a href="/add.php">Add Book</a></li>
<?php endif; ?>
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Steve Meadows
Full Stack JavaScript Techdegree Student 15,218 Points0 Answers
-
Nick Girling
4,607 Points5 Answers
-
Justin Sorensen
14,734 Points7 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up