PHP Tutorial – Login using Session
System flow chart
profile.sql login.php
No
username &
password
provided?
Yes
sessionHandler.php
Valid
username &
login-failed.html No
Password?
status=false
Yes
authenticator.php
login-successful.php
logout.php
Figure 1: Login system structure
Table 1: Description of each web page file
File Name Description
login.php Login interface.
sessionHandler.php To handle login information and create a session for that user.
authenticator.php To verify user identity in accessing this website. Include this file in every
protected page to avoid unauthorized user enter.
login-successful.php To display protected web page if user is valid. If you enter directly to this
page, you will be checked by the authenticator, and then redirect to login-
failed.html.
login-failed.html To display error message if user is invalid.
logout.php To logout from the website and destroy the self identity.
Creating ‘profile’ table using ‘ngchoonching’ database
Insert dummy data
Creating Server Side Scripting, PHP
1. Creating index file named as “login.php”
2. Creating database connection scripting named as “sessionHandler.php”
3. Creating insert page interface named as “authenticator.php”
4. Creating insert query scripting named as “login-successful.php”
5. Creating display page named as “login-failed.html”
6. Creating update query scripting named as “logout.php