Login using cookies

This application shows cookies can be used in a login system. A cookie is a small piece of information that is stored on the users computer. A script at the beginning of each page checks to see if the logged in value has been set. If it has, the user is allowed to view the page. If not the user is redirected to a login failure screen

On the main page (page.php) there is a script that checks to see if there is a cookie that indicates the person has been logged in. If there is no cookie or it has the incorrect value the person is booted to login form. This keeps people from "bookmarking" a spot in your site and bypassing the login. If you do not have a mechanism like this on every page in your site it is the equivalent of having an iron gate to gaurd your property, but no fence around the rest of the property.

Return to 702 Home Page

Try to go to protected page

Code for application

page.php
loginform.php
loginengine.php
loginfailed.php