Home and Learn: PHP Programming Course

User Authentication - Introduction

A lot of sites add a members section, where users are authenticated by means of a username and password. Once the user is logged in successfully, he or she can then gain access to the restricted areas of the site. You'll see how to do that in this walkthrough.

For the walkthrough, there are some scripts already prepared. These can be found in the login folder, which is one of the folders you downloaded. (It's in the scripts folder.)

In this walkthrough, we'll explore some of the things you need to bear in mind when creating a username/password section on your site. What we don't offer is a complete login script. This is, after all, a tutorial site, and we'd much rather help you develop your own scripts.

A word about the database used for this section

The database we've set up for these tutorials is as simple as they come. It consists of a table called login, with three fields: an ID field, a field for the username (called L1), and a field for the password (called L2). We're using a simple table, so as not to complicate the tutorials. But you'll want to add more fields, when you come to implement your own login pages. For example, you may want an email address field so that you can send a new member a message about successful registration, and a timestamp field so you know when the user signed up.

But click the next part to get started.

Move on to the Next Part -->

Back to the PHP Contents Page


Email us: enquiry at homeandlearn.co.uk