PHP SOLUTIONS: DYNAMIC WEB DESIGN (Best web site) MADE EASY 2.

PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY 2. You now need to add the script that runs when the logout button is clicked. Amend the code above the DOCTYPE declaration like this (the code is in menu02.php): This is the same code as in Destroying a session earlier in the chapter. The only differences are that it s enclosed in a conditional statement so that it runs only when the logout button is clicked, and it uses header() to redirect the user to login.php. 3. Save menu.php and test it by clicking Log out. You should be redirected to login.php. Any attempt to return to menu.php or secretpage.php will bring you back to login.php. 4. You can put the same code in every restricted page; but PHP is all about saving work, not making it. It makes sense to turn this into an include file. Create a new file called logout.inc.php in the includes folder. Cut and paste the new code from steps 1 and 2 into the new file like this (it s in logout.inc.php in the download files): Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.

Leave a Reply