44: How to create a complete login system in PHP (READ DESC) | PHP tutorial | Learn PHP programming. How to create a complete login system in PHP. In this PHP tutorial you will learn how to create an simple PHP login system from scratch, and how to show content after being logged in. In this PHP login tutorial, you will learn about error handlers, and MySQLi databases, which includes how to make a login form and a signup form.
READ THIS FIRST!!!
I am aware that we need to connect to the database using Prepared Statements in order to make the login system more secure. This video was uploaded before I had taught prepared statements in this course, which is why I left it out of this video.
So if you wish to see how it is done using Prepared Statements, you can do so in my downloadable lesson files, or watch my "prepared statements" lesson a few episodes back.
ALSO, for the people who ask why I didn't use PDO to connect to the database, I want to remind everyone that PDO is used in Object Oriented PHP ONLY! Therefore we can't use it in this episode since we are doing procedural programming.
ERRORS YOU MIGHT RUN INTO!!!
If you keep getting a "signup=empty" message after creating the signup script and trying it out, it is very likely caused by the mysqli_real_escape_string() function. To fix this, remove this function completely and instead use prepared statements.
2: "unexpected }"
If you get this error message:
Parse error: syntax error, unexpected '}'
Then it is because you forgot to close a ) somewhere.
3: "unexpected ;"
If you get this error message:
Parse error: syntax error, unexpected ';'
Then it is because you forgot to close a } somewhere.
4: "hashed pwd error"
If you get an error in the script when you hash the password, then it is because you decided not to follow my steps exactly in the video when I created the database table. Make sure you DON'T set the varchar() to a lower value! When you hash the password it will take up a lot of space in this column, and if you set a lower number then it won't fit!
5: "signup=success but database is empty?"
Here there might be two reasons for your error. 1st is that you made a syntax/spelling mistake in your code. And yes you will claim that your code is identical to mine, but in 80% of the cases people claim this, I still find a syntax error in their code. So check your code for errors!
2nd reason might be because you didn't follow the tutorial 100% when we set up the database at the beginning. MAKE SURE that you don't set the values of the columns lower than mine (user_pwd varchar(256) not null). Otherwise the password won't fit in the column after we hash it!
6: "HTTP ERROR 500"
HTTP ERROR 500 is a server error, meaning that you are most likely using an outdated version of apache or mysql. Try updating your servers and make sure that you are using the latest version of PHP.
1: (02:43) Setup our database
2: (10:24) Create the visuals using HTML & CSS
3: (36:25) Connect to our database
4: (40:46) Create the sign up PHP script
5: (1:07:09) Create the login/logout PHP script
How to set up a local server on your PC: https://www.youtube.com/watch?v=mXdpCRgR-xE&list=PL0eyrZgxdwhwBToawjm9faF1ixePexft-&index=2
CSS reset code: http://html5doctor.com/html-5-reset-stylesheet/
How to find the Pipe symbol on your keyboard: https://www.computerhope.com/jargon/p/pipe.htm
➤ GET ACCESS TO MY LESSON MATERIAL HERE!
First of all, thank you for all the support you have given me!
I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!
I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.
I hope you will find it helpful :)
Material for this lesson: https://www.patreon.com/posts/php-44-download-15654514
Tags: 44: How to create a complete login system in PHP (READ DESC) | PHP tutorial | Learn PHP programming, how to create a complete login system in php, how to create a login system in php, login system in php, login system php, php login system, how to make a login system in php, easy login system, how to make a login system, how to make a php login system, php tutorial, php login, php login tutorial, login tutorial in php, learn php, php for beginners, simple php login tutorial, php beginners, how to make a login form, php, login system security, php login and register tutorial