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