if (isset($_SESSION[ name ])) { echo ; echo

if (isset($_SESSION[ name ])) { echo

; echo Currently logged in as: . $_SESSION[ name ]; echo

; } The following is the search form, displayed on every page. We did not discuss this functionality earlier; we hope you discovered this little gem in your explorations of the application. Now you get to see how it works. Note that there really isn t anything special going on here; it is a standard form that posts the keywords field to search.php. If there are keywords in the URL, they will be prefilled in the keywords field. We look at the search results page a little later.

Search

>

In most cases, there are three values you save as session variables: the user s name, login ID, and access level. You use those values to determine what menu items to display. Here are the options: . Article: All users . Login: All users not logged in . Compose: All logged-in users . Review: All logged-in users with access level 2 or more . Admin: All logged-in users with access level 3 or more . Control Panel: All logged-in users . Logout: All logged-in users echo Articles ; if (!isset($_SESSION[ user_id ])) { echo | Login ; } else { echo | Compose ; if ($_SESSION[ access_lvl ] > 1) { echo | Review ; } if ($_SESSION[ access_lvl ] > 2) { echo | Admin ; 430 Chapter 13
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Leave a Reply