From the course: PHP with MySQL Essential Training: 2 Build a CMS
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Authenticate user access
From the course: PHP with MySQL Essential Training: 2 Build a CMS
Authenticate user access
- [Instructor] In this movie, we'll learn to authenticate user access. In other words, we'll write the code that will allow a user to log in with a username and a password. Before we dive in and look at the code, I'm going to add a new file. It's in the exercise files, it's called auth_functions.php, and I'm going to put it in my private directory. This is a place where I'm going to store all of the functions related to authorizing a user. It'll just keep them separate from everything else. So let's go in to our code, and the first thing I need to do is go to initialize.php. And make sure that the authorization functions are also required. Let's just add that right here. Auth_functions.php. Okay, so now that I have my authorization functions, let's take a look at what's in them. You see I have simply one function here called log_in_admin. And when I pass it in, an associative array for the admin, this admin object that we're working with, it's going to take care of all the business…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
User authentication overview5m 11s
-
(Locked)
Create admins table3m 7s
-
(Locked)
Challenge: Build admin management3m 52s
-
(Locked)
Solution: Build admin management6m 30s
-
(Locked)
PHP password functions7m 27s
-
(Locked)
Authenticate user access8m 27s
-
(Locked)
Require authorization6m 15s
-
(Locked)
Log out a user2m 48s
-
(Locked)
Optional password updating6m 2s
-
(Locked)
Authorized previewing3m 46s
-
(Locked)
-
-