Building a PHP Authentication System

Video Lectures

Displaying all 33 video lectures.
Lecture 1
Introduction
Play Video
Introduction
Build a PHP authentication system featuring registering, logging in, remembering users, resetting passwords, updating profiles and more.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 2
Dependencies
Play Video
Dependencies
To help us along the way, we need a few project dependencies. This includes our base framework, Slim 2, and various other packages so we can develop quickly and efficiently.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 3
Setting Up
Play Video
Setting Up
Let's define some project structure and boot up our Slim app!



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 4
Configuration
Play Video
Configuration
We need to easily pull configuration in throughout our project. We also need to be able to switch between different configuration modes so we can seperate development and live settings.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 5
Users Table
Play Video
Users Table
We need a database table to store our registered users. Here, we create the table in a MySQL database.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 6
Adding Database Support
Play Video
Adding Database Support
We're adding database support through Models with Eloquent. This allows us to create our User model later and create, updated and find user records.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 7
User Model
Play Video
User Model
Our User model will serve as every way to handle users, from creating, updating and finding records, to creating relationships between users and other models.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 8
Routes & Views
Play Video
Routes & Views
Creating our first view to show the homepage, and dealing with our project templates. We're using Twig as our template engine.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 9
Flashing Messages
Play Video
Flashing Messages
Flashing messages allows us to show a message to inform a user something has happened, e.g. "You have just been registered". We'll be using this throughout the system, so here we look at how to do this.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 10
Password Hashing
Play Video
Password Hashing
Passwords need to be stored hashed in our database, so we're going to build a Hash helper to easily hash passwords using the PHP Password Hashing API.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 11
Registering
Play Video
Registering
Finally, we arive at being able to register a user via an HTML form, insert a record in the database and tell them they've registered.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 12
Validation
Play Video
Validation
Validation is a massive part of any project, so here we implement a validation class that extends Violin, the package we're using to easily validate anything a user posts.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 13
Unique Emails/Usernames
Play Video
Unique Emails/Usernames
Validating the email and username to check if they already exist in the database. If they do, we want to display an error through our normal validation process.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 14
Logging In
Play Video
Logging In
It's time to allow our users to log in! This involves creating the form, setting sessions and modifying our container so our system knows a user is authenticated.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 15
Sending Email
Play Video
Sending Email
Sending email is an important part of any application, so here, we set up the ability to send emails easily. We'll also use views for our email content, making it easier and cleaner to define what we want to send.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 16
Email Templates
Play Video
Email Templates
Email templates allow us to define a common template for all emails, making it easier to design and include partials.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 17
Hashing & Random Strings
Play Video
Hashing & Random Strings
Setting up the ability to generate long random strings and hashing so we can enfore a higher level of security in our authentication system.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 18
Account Activation
Play Video
Account Activation
Building in the requirement for a user to activate their account by email.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 19
Filters
Play Video
Filters
Filters allow us to easily protect routes from non-authenticated users, and stop authentication users accessing pages like /login and /register when they're logged in.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 20
CSRF Protection
Play Video
CSRF Protection
Cross-site Request Forgery (CSRF) protection prevents a user having a form submitted on their behalf by someone outside of our website. Here, we set it up and add it to our register and login forms.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 21
Logging Out
Play Video
Logging Out
Naturally, we need to allow authenticated users to log out of their account, so we're going to implement a simple route for them to do so.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 22
Profile Pictures
Play Video
Profile Pictures
Displaying user avatars from Gravatar, a service that allows avatars to be used globally accross different websites.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 23
Remember Me
Play Video
Remember Me
Allowing users to be remembered by checking 'remember me' when they log in.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 24
User Profile
Play Video
User Profile
Displaying a user profile for any registered user.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 25
List All Users
Play Video
List All Users
Listing all of the registered users on one page, so we can click through and view their profiles.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 26
User Permissions
Play Video
User Permissions
Allowing users to have simple individual permissions.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 27
Custom 404 Page
Play Video
Custom 404 Page
Up until now, we've been seeing the default Slim 404 page. Let's create our own.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 28
Change Password
Play Video
Change Password
Building in the ability for a signed in user to change their password, ensuring we check their old password matches.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 29
Forgot Password
Play Video
Forgot Password
If a user forgets their password, we can start a recovery process which emails them, prompting them to click a link to change their password.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 30
Update User Profile
Play Video
Update User Profile
Allow users to update their profile details (even settings, if you add them).



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 31
Fix Signing In For Inactive Users
Play Video
Fix Signing In For Inactive Users
Users can currently sign in with their username (not their email) if they haven't activated their account. In this video, we fix that up.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 32
Fix Returning When Redirecting
Play Video
Fix Returning When Redirecting
Returning a redirect request within our routes so we don't run into any redirection trouble.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy
Lecture 33
Better Email Support
Play Video
Better Email Support
We move away from PHPMailer to a 3rd party solution for sending email.



Subscribe here for more tutorials: http://www.youtube.com/subscription_center?add_user=phpacade...

Our channel
http://youtube.com/phpacademy

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy