From the course: PHP with MySQL Essential Training: 2 Build a CMS

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Authorized previewing

Authorized previewing

- [Instructor] In an earlier chapter, we created a feature that will allow admins to be able to preview content just as the public would see it but before the content was made visible to the public. And at the time, if you'll remember, we put a note in there that we wanted to come back to this topic once we understood user authentication so that we could actually make sure that the previewing was authorized by someone actually being logged in. Now that we understand user authentication, we can revisit that topic. The place where we added that preview code is in index.php inside the public directory. This is the main page for displaying content to the public. And you can see that we're checking here to see whether or not preview has been set, and whether it's been set to true, and if it has, then we're going to allow the user to preview the content. Let's take a look at that. Over here in my staff area, I'm going to find one of my pages that is set to be not visible. Going to view it…

Contents