"Spring with Hibernate" was retired on January 8, 2022.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Introduction to User Authentication in PHP!
You have completed Introduction to User Authentication in PHP!
To manage the book, we want to make sure that the logged in user is either an administrator or the owner of the book.
Updates
templates/book.php
<?php if (isAdmin() || isOwner($book['owner_id'])) : ?>
// Edit and Delete links
<?php endif; ?>
Proceedures: addBook.php and deleteBook.php
requireAuth();
if(!isAdmin() && !isOwner($book['owner_id'])) {
$session->getFlashBag()->add('error', 'Not Authorized');
redirect('/books.php');
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated 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