Figure 12-5 How It Works (Web server iis) The PHP pages

Figure 12-5 How It Works The PHP pages you just created are used to authorize a user who is trying to view a certain section of your site. When you navigate to a page, the auth.inc.php page checks to see if you are or aren t already an authorized user, and then the page either sends you to the login page or displays the page you were requesting. Here is the part of the code that is actually doing the checking: if (isset($_SESSION[ logged ]) && $_SESSION[ logged ] == 1 The $_SESSION[ logged ] is the variable you are checking for, and the 1 is another way of checking for true. Right now, you only have a username and password hard-coded into your page. If you want numerous users, you would have to edit your page accordingly and add those values for those users. Sessions will look more useful when you are using database-driven information rather than the hard-coded values. 374 Chapter 12
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Leave a Reply