Login System Tutorial with PHP and MYSQL Database

PHP login system tutorial, using MySQL database and sessions, which includes registration, login, log out, and reset password functionality.

Download source code:

Text version of this video:

The registered users will be stored in a MySQL database and sessions will be implemented to know when the user has been logged in and logged out. The reset password functionality process is also included, in case a user forgets their password.

After watching this video you will learn and understand how the complete login system works using PHP and MySQL and will be able to modify the code so you can integrate it into your own web site.

Please subscribe to clevertechie.com newsletter for new video and tutorial updates and you’ll get a free PHP programming book:


( New Video! ) How to Create Transparent Drop Down Navigation Menu with CSS and HTML



( Website ) https://clevertechie.com – PHP, JavaScript, WordPress, CSS, and HTML tutorials in video and text format with cool looking graphics and diagrams.

( YouTube Channel ) https://www.youtube.com/c/CleverTechieTube

( Google Plus ) https://goo.gl/J71p6f – clever techie video tutorials.

( Facebook ) https://www.facebook.com/CleverTechie/

( Twitter ) https://twitter.com/theclevertechie



Tkco says:

Fatal error: Call to undefined method mysqli::error() in /Users/coltenlange/Sites/www/site/register.php on line 19

khmer happy says:

Hello Sir! I want to create an account for one person by using php. Could you do and post it? Thanks a lot!

Arfiani Arfiani says:

Its awesome tutorial

Ogunleye Oluwasemilore says:

Where can I download the source code for the system

Kobe Ramos says:

give me that shit! Ha! ha!

Prospeed orginal says:

Hello Clever, i’m having a problem where when i put the source code in “login-system’ in www folder (WAMP), it only errors. Any solutions?

Lynn says:

Tried to get the ebook and never get a confirmation email? Tried 3 times.

What did you draft the login-system-chart.png? Image software or some kinda drafting software it looks great and easy to read.

Daniel Sushik says:

Great tutorial! Can you tell me what program you used to create the chart?

Terry1212 says:

Nice tutorial. Just a couple things to consider: email and email hash should have UNIQUE indexes. This will prevent duplicates from being inserted into the database. The PHP code does perform a check on the email, but not the email hash. md5(rand(0, 1000) gives a total of 1001 possible email hashes that can be inserted into the database. As more people register, the odds of a duplicate being inserted increase.

Emma Lee says:

mysql is not a command. does this work on mac computers?!?!>!?!?!?!?1

Clever Techie says:

To all the people who are asking about not getting account verification email. You need to modify php.ini and set your email and email host settings. Here are my settings:

SMTP = smtp.west.cox.net
smtp_port = 25
sendmail_from = vladi@clevertechie.com

You need to find out what your SMTP is and configure accordingly.

Zero Gravity says:

php.ini is not available in my cpanel what to do


Which editor you are using in this video at time = 7:49
Please reply fast.

ZoopShupShock says:

bro very nice video and complete php form perfect video in whole youtube the only thing is missing is profile pictures fuctions in profile.php. can you please make that one video with upload profile picture on your profile i think you understand what i mean

Darshan A.N. says:

does anyone configure php.ini file in ubuntu? I tried configuring the php.ini and Sendmail.ini, but couldn’t get the result as expected.

Jitendra Kumar says:

How did you create the chart with the list of all files? Did you use a mind mapping tool?

Victor M. Barba says:

Hi Clever Techie, I got your files. Thank you for this video. When I click on the E-mail field or any field, I see “This connection is not secure. Logins enter here can be compromised. I see the Grey Padlock, with a RED line across. I don’t see the “Green Padlock” for secure web-sites. Could you please help me to understand why I don’t have the green padlock, and how I can have a secure log in. Thank you.

brazildesigncolor ART says:

it very good teacher

Space Surfer says:

the signup – function is not working … i get
“index.php:1 POST localhost/login-system/index.php 500 (Internal Server Error)”
once i “register”.
My System is a Raspi with Raspbian and LAMP server

Computer Science says:

usually computer code gets iutdated.. this one is fresh and working good though the logout page still works even though you still not logged in

Dini says:

Great video dude, really helped me out. But when I download the sourcecode and run it on opera, it turns out as just code and not as the login system. Could you please help me?

Tchabo Paul says:

Thanks for the video, but i still can’t receive the verificationmail in inbox

Abhijeet Khatri says:

The name is too cool bro.

David Yakovlev says:

How to see my sent emails?I use usbwebserver 8.0

Shaistha Seema says:

Hey Clever Techie ,
Can You please teach me how to create a login form for multiple users like admin,staff,HOD etc… . without any registration. Can you please post a tutorial. My humble request.

Prospeed orginal says:

Does anyone have any links to configure a working email client for WAMP?


hi , the mail verification still not working any help please ??

Marko I. says:

How to change this text:

“please fill out this field …” ?

userdash says:

thanks for the video,, i am facing this error;

Warning: Cannot modify header information – headers already sent by (output started at C:wampwwwlogin-systemindex.php:10) in C:wampwwwlogin-systemlogin.php on line 29

Tommaso Morganti says:

Logging in just reloads the page (same result with both right and wrong passwords), I have to manually go to the profile.php page to see I’m actually logged in, does anybody know why?

omagoro ivan says:

am not seeing the source code techie

smash games says:

PLEASE HELP!! i am getting this error after i try to register on my login.php …..” Fatal error: Uncaught Error: Call to a member function escape_string() on null in E:xampphtdocsHTD1login.php:5 Stack trace: #0 {main} thrown in E:xampphtdocsHTD1login.php on line 5″…any help please i havent changed anything on the code

Robert Smith says:

Just wanting “”

Uo?3 7

Darshan A.N. says:

could u please tell me how to output the mysql query results to a text file?
if anyone knows abt it, please comment down here…
thank you…

Darshan A.N. says:

could u please make a video on admin panel… it would be much helpful to students like us…

Victor M. Barba says:

I type my name, last name , e-mail and password, and I got this – Fatal error: Call to undefined function password_hash() in line 15. Line 15 is this: $password = $mysqli->escape_string(password_hash($_POST[‘password’], PASSWORD_BCRYPT));
What can it be? Please would you help me.

Jeffrey Eugenio says:

hello .. I am thankfull of your video because of it help me on my first php project login system but I encounter an error on index.php..
require ‘db.php’ & on mysqli…
what shoud I do?

( ! ) Warning: mysqli::mysqli(): (HY000/1045): Access denied for user ‘root’@’localhost’ (using password: YES) in C:wamp64wwwlogin-system_newdb.php on line 7
Call Stack
{main}( )
require( ‘C:wamp64wwwlogin-system_newdb.php’ )
mysqli ( )

Write a comment


Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours