Login and Registration from Scratch with PHP and MySQL
4.5 (73 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
1,103 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Login and Registration from Scratch with PHP and MySQL to your Wishlist.

Add to Wishlist

Login and Registration from Scratch with PHP and MySQL

Create a PHP login system including user sign-up, login, "remember me", password reset and user administration.
4.5 (73 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
1,103 students enrolled
Created by Dave Hollingworth
Last updated 8/2016
English
Price: $20
30-Day Money-Back Guarantee
Includes:
  • 2 hours on-demand video
  • 2 Articles
  • 3 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Create a website where users can sign-up for a new account
  • Let users login and logout, providing them with personalised content
  • Give users the option to remember their login, even after closing the browser
  • Let users securely reset their own password if they forget it
  • Require users to confirm their email address before they can login
  • Administer registered users with a user administration backend
  • Apply advanced techniques using HTML5 and JavaScript to improve usability and performance
View Curriculum
Requirements
  • You should be familiar with using PHP and MySQL to create a database driven web page
  • Basic knowledge of how to use PHP classes
Description

Do you already know PHP and you're developing a website that needs user registration and login? By taking this course you'll learn how to develop a system from scratch where users can sign-up for a new account, login, and be provided with personalised content.

This course will teach you how to add the following features to your PHP website or web application:

  • User sign-up, including account activation by email
  • Login and logout
  • Protecting content for logged-in users only
  • "Remember me" functionality: remember the login even after closing the browser
  • Secure password reset: let the users reset their own passwords when they forget them
  • User administration: create, view, edit and delete users.


Additional lectures include improving the usability of the site with new HTML5 and JavaScript techniques.

Taught by experienced web application developer and online educator Dave Hollingworth, this course takes you in easy steps through the entire process of creating a website that includes user authentication. This course will take you step by step through the project until all the principles have been covered.

All the source code is included with the lectures, with clear comments in the code and all the guidance you need to create your own user authentication system.

This popular course has been completely rewritten and re-published in April 2015, replacing every lecture and adding over 20 brand new ones, with improved, more secure source code, and an entirely new user administration area.

Who is the target audience?
  • This programming course is meant for people who are developing a website that need to have users sign-up and login so they can be provided with personalised, private content. All aspects of a creating a user login system are covered, from basic to advanced.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
Expand All 36 Lectures Collapse All 36 Lectures 01:58:15
+
Introduction: set up the project structure and configure the database
4 Lectures 10:28

Get an overview of what you're going to learn, how the project is structured, and start with first code for building your site.

The code shown in the video is attached and available to download in the resources section.

Preview 03:26

How to get the best out of the course by using the source code.

Preview 1 page

Use PHP class autoloading to make your code easier to write and maintain.

The code changes shown in the video are attached and available to download in the resources section.

Preview 03:48

Create the users table in the database and add the a configuration class to the code.

The code changes shown in the video are attached and available to download in the resources section, along with the MySQL database schema for creating the users table.

Preview 03:14

Test your knowledge of PHP class autoloading.

Autoloading classes in PHP
2 questions
+
New user signup: create new users in the database
4 Lectures 12:39

Why it's important to store passwords securely and how to do it easily.

The code changes shown in the video are attached and available to download in the resources section.

Preview 04:18

Starting from version 5.5, PHP now includes functions for password hashing. So if you are using PHP 5.5 or later, you can use those instead of the PHPass library.

Preview 00:46

Create a page where the user can register a new account on your site.

The code changes shown in the video are attached and available to download in the resources section.

Preview 03:21

Validate the signup data before it's saved in the database, getting the user to make changes and submit the form again if anything is invalid.

The code changes shown in the video are attached and available to download in the resources section.

Preview 04:14

Test your knowledge of the proper way to store passwords securely.

Securely storing passwords
3 questions
+
Log users in and out, and remember and require login
8 Lectures 28:41

How to remember state between pages using PHP sessions.

The code changes shown in the video are attached and available to download in the resources section.

How to make the web browser remember the user between page visits
02:08

Create a login page and let the user identify themselves by logging in.

The code changes shown in the video are attached and available to download in the resources section.

User login: let users identify themselves as registered users of your site
05:55

Let a user logout from your site, destroying the session.

The code changes shown in the video are attached and available to download in the resources section.

User logout: let users safely leave our site and become anonymous again
01:54

Restrict whole pages or parts of a page to logged-in users only.

The code changes shown in the video are attached and available to download in the resources section.

Require users to login before they can see certain content
03:21

Restrict whole pages or parts of a page to anonymous (i.e. those that haven't logged in) users only.

The code changes shown in the video are attached and available to download in the resources section.

Show certain content to unauthenticated (guest) users only
01:43

Add the option to remember the user's login even after they've closed the browser. Enable this functionality across multiple devices (PC, mobile etc.) for the same user.

The code changes shown in the video are attached and available to download in the resources section, along with the MySQL database schema for creating the remembered_logins table.

Remember the login: log a user in automatically the next time they visit
06:54

See the remember me functionality, developed in the previous video, in action.

Preview 02:09

Forget the remembered login when the user explicitly logs out, and clean up any expired remember tokens that have been left in the database.

The code changes shown in the video are attached and available to download in the resources section.

Forget the remembered login if the user logs out
04:37

Test your knowledge of the login and remember me functionality.

Logging in and remembering the login
3 questions
+
Reset forgotten passwords and activate new accounts before allowing login
5 Lectures 16:14

For password resets and account authentication, we'll need to send registered users an email from PHP. Add a class to send emails from code in a very simple way.

The code changes shown in the video are attached and available to download in the resources section.

The simple, quick and reliable way to send an email from a PHP script
02:28

Users will forget their passwords - provide a secure way for them to reset their own password without needing an administrator.

The code changes shown in the video are attached and available to download in the resources section, along with the MySQL database schema for adding the password reset fields to the users table.

Let users safely reset their own passwords when they forget them
05:25

See the password reset functionality, developed in the previous video, in action.

Preview 01:31

Require a newly registered user to confirm their email address before allowing them to login, by sending them an email containing a link that contains a unique token.

The code changes shown in the video are attached and available to download in the resources section, along with the MySQL database schema for adding the account activation fields to the users table.

Make sure a new user's email address is real before allowing them to login
04:42

See the account activation functionality, developed in the previous video, in action.

Preview 02:08

Test your knowledge of password reset and account activation functionality.

Password reset and account activation
3 questions
+
User administration: view, edit, create and delete registered users
8 Lectures 27:54

Add an administrator role to the users table, so you can identify which users can access the administration area, and add a link to the administration area to the main site navigation.

The code changes shown in the video are attached and available to download in the resources section, along with the MySQL database schema for adding the administrator role field to the users table.

Add administrators to your website to enable administration of other users
02:57

Add the admin area to the code and start with a paginated list of all the users in the database. Restrict access to this page to administrators only, denying access to those users who don't have the administrator role.

The code changes shown in the video are attached and available to download in the resources section.

View a paginated list of all registered users, restricted to administrators only
04:34

Show all the data for a single user in the database, restricted to administrator users only.

The code changes shown in the video are attached and available to download in the resources section.

View all the data for a single user
01:57

Edit a single user's data, restricted to administrator users only.

The code changes shown in the video are attached and available to download in the resources section.

Make changes to a user’s data
05:17

Delete a single user record from the database, restricted to administrator users only.

The code changes shown in the video are attached and available to download in the resources section.

Delete a user from the database
02:00

Most users will create accounts themselves using the signup form, however it might be necessary for an administrator to create a user. Add a single user record to the database, restricted to administrator users only.

The code changes shown in the video are attached and available to download in the resources section.

Add a new user without them signing up themselves
04:58

As it stands, an administrator user could edit their own user and remove the administrator role, or even worse, delete their own user, thereby locking themselves out. Prevent this by disabling the controls that would allow an administrator to do this.

The code changes shown in the video are attached and available to download in the resources section.

Stop an administrator from locking themselves out or deleting their own user
04:35

At this stage we have a fully functional user authentication system, which includes the following features:

  • Signup, with account activation by email
  • Login and logout
  • Protected content
  • Remember me (across multiple devices)
  • Password reset
  • User administration
There are some alternatives if you don't want to code all this yourself, which we'll see here, and we'll also look at what's coming up in the next lectures.
The story so far, alternatives, and what's coming next
01:36

Test your knowledge of the user administration area.

User administration
3 questions
+
Usability, functionality and design improvements
7 Lectures 21:25

Speed up the process of signing up to your site by adding client-side validation to the signup form using HTML5 form validation methods.

The code changes shown in the video are attached and available to download in the resources section.

Speed up the signup process by validating the signup data using HTML5
03:54

Add JavaScript and the jQuery library to your site, optimising for faster site performance.

The code changes shown in the video are attached and available to download in the resources section.

Add JavaScript and make it easier to code by using the jQuery library
02:18

Add JavaScript validation to the signup form, enabling it for non-HTML5 browsers, and also allowing us to do remote validation using AJAX.

The code changes shown in the video are attached and available to download in the resources section.

Improve the signup process even further by validating using JavaScript
04:52

Now that we have client side validation on the signup form, we can add it to the similar form for creating or editing a user in the user admin area.

The code changes shown in the video are attached and available to download in the resources section.

Add the same JavaScript validation to the user administration form
03:17

Make filling in forms easier by avoiding the additional click required after opening a page with a form, and add client-side validation to the password reset form.

The code changes shown in the video are attached and available to download in the resources section.

Add more validation and autofocus to make filling in forms easier
02:45

Currently our application is functional, but doesn't look too great. Use a front-end framework and add a CSS file to our application to make it look great, and work in every browser, in no time.

The code changes shown in the video are attached and available to download in the resources section.

Make it look great in minutes, in any browser, without writing any CSS
04:05

Full source code that includes all the incremental changes we've made throughout the course.

Full source code
00:14
About the Instructor
Dave Hollingworth
4.7 Average rating
514 Reviews
2,827 Students
6 Courses

Hi, I'm Dave Hollingworth. I'm an IT trainer and web application developer. I've been programming for over twenty-five years, and teaching IT since 1999.

I've developed enterprise-level applications on platforms ranging from mainframes to mobiles: from my first web application, a quotes system created for a major insurance company back in 1999 - the first of its type in the sector - to interactive learning management systems for online language learning.

I've taught courses ranging from basic use of email to advanced web application development, both online and in-person. I've been teaching on Udemy since 2012.

I'm passionate about technology, and love teaching it! I believe it's possible to explain even the most complex subjects in a simple, straightforward way that doesn't confuse the student.

I look forward to welcoming you onto one of my courses!