Chapter 15. User Authentication

In this lesson you will build a user authentication process that can be used to protect certain pages of your website by using a password.

Types of Authentication

Chances are you have needed to log in to a website in the past, so you should be aware of how the process of authentication works from a user's point of view. Generally speaking, you are asked to enter a username—sometimes your email address—and a password.

There are actually two ways that a website can authenticate a user, though: using basic HTTP authentication and using session-based authentication. The following sections clarify the differences between these two methods.

Basic HTTP Authentication

Basic HTTP authentication can be performed by web server, ...

Get Sams Teach Yourself PHP in 10 Minutes now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.