Skip to Content
PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
book

PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide

by Larry Ullman
May 2003
Intermediate to advanced
592 pages
14h 28m
English
Peachpit Press
Content preview from PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide

Logging In and Logging Out

In Chapter 7, “Cookies and Sessions,” 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 stick to the practices of the whole application.

To write login.php:

1.
Create a new document in your text editor (Script 12.7).
<?php # Script 12.7 - login.php
2.
Require the configuration file and the HTML header.
require_once ('includes/config.inc');
$page_title = 'Login';
include ('includes/header.html');
3.
Check if the form has been submitted, require the database connection, and validate the submitted data.
 if (isset($_POST['submit'])) { require_once ('../mysql_connect.php'); if (empty($_POST['username'])) { ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

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

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

Larry Ullman

Publisher Resources

ISBN: 0321186486Purchase book