O'Reilly logo

PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition by Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required