Logging In and Logging Out
In Chapter 9, I wrote many versions of the login.php and logout.php scripts, using variations on cookies and sessions. Here I’ll develop standardized versions of both that adhere to the same practices as the whole application. The login query itself is slightly different here in that it also checks that the active column has a NULL value, which means that the user has activated their account.
To write login.php
1. | Create a new document in your text editor (Script 13.8).
<?php # Script 13.8 - login.php Script 13.8. The login form will redirect the user to the home page after registering the first name and user ID values in a session
|
2. | Require the configuration file and the HTML header. ... |
Get PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.