|
Detecting LoginNow that we have integrated the forum into the website templates, we might want the ability to detect if an user member is logged in or not. Suppose for example, that we want to display a greeting to the user at the home page of the site, which happens to be outside of the forums directory.
If the user is logged in, we greet the user with his/her username as shown above. If not logged in, we display the following...
The forum PHP application keeps track of whether a user is logged in by using session management with cookies. Each of the forum PHP application pages have session managment code that performs this tracking. We are going to borrow that same code in our external index.php home page. At the top of our index.php page where we want to use this session management code, we write the following PHP code before the doctype and the html tags.
In the greeting area of the same index.php page, we write some conditional PHP code...
And that should work. Next Lesson:Go to Next Lesson learn how to run the search function in an external page. |





