For some mysterious reason, I could not get main.php to load from my web server, even though it worked just fine on my pc. The only way it would load was if I commented out the line to include 401.php. So that means I needed a workaround to keep unauthorized users away from the page. I used the following:
Code:
if (!isset($_SESSION['access']) || $_SESSION['access'] != true) {
header('Location: 401.php');
}
This serves same purpose as including the 401.php at the beginning of the file. As I said, the code from the book worked fine on my windows pc with Apache, but not on my web host. Must be some kind of a quirk with my Unix server.
I wanted to post this in case anyone else runs into the same problem, so you won't have to waste half of your day trying to figure out what the problem is.
These forums are a great resource. Whenever I run into problems with the code from the book, I always check here first to see if someone has already posted a solution. This has saved me a lot of time and frustration, so when I find a solution that is not already posted, I try to come back and share it with others.