Register the user in the database | PHP and MySQL secure login system | Part 1

preview_player
Показать описание
Hi guys. In this tutorial we are going to create a secure login system with php and mysql.
We are gonna have a register page, a login page, a forgot password page, and an user account page where the user is going to be redirected when he logs in successfully.

Every input field will have a proper and secure validation, so you can easy implement the code in a live website.

This is the first video of a three series and we are going to see how to connect to a database
and register the user.

To learn about prepared statements you can watch the video:
or read the article:

You can buy me a coffee and get the whole source code in a zip file.
The code is updated and uses the PHPMailer library to send emails.

If you don't know how to configure PHPMailer watch this video:
or
Read the article on my website.
Рекомендации по теме
Комментарии
Автор

what a nice tutorial to watch. Thanks for making this!

RodolphoArrudanogoogle
Автор

This will help in my Final Year Project !! Thanks ❤

santosh_rawat
Автор

I think you have security problem with the "forgot password" function. It asks for an email address then only checks that the address exists in the database. If a user has an account (or just creates one) they can break into any other account that they know the user name for. They just say "forgot password" on it, then enter their own email address and get a password for the other account.
I think what it should do is ask for the user name, then send the changed pw to the email on file for that user. Just checking the email exists is too weak.

castletown
Автор

Thank you, this tutorial was very concise and well explained.

lanzmanlapaz
Автор

Hey George! I follow along with your tutorial, but I am not able to login even if I input a valid credentials on it.

alababbuenaventurajr.l.
Автор

"Hello sir, I'm a junior web developer and I'm working on a project that requires a login and registration system. I'm a bit confused about a piece of code I've come across. What would happen if I use the following PHP code for registration?

// Class definition
class Register {
public function register($username) {
// Codes to handle username with session
}
}

// Create object
$register = new Register();

// Method call
echo

Would this kind of code structure work if it was made good or is it better to use this kind of structure.

Thank you so much .

suleymanates
Автор

Hi, downloaded src code from ur site, setted up db and everything, registration isn't working. Says An error occurred. Please try again. Other things like resetting password, login for manually added user working correctly. DB Log is empty too

fcntl
Автор

This is very valuable content, bro. Thank you.

rokitgg
Автор

"FILTER_SANITIZE_STRING" seems to be deprecated in PHP 8.1

ravegameofficial
Автор

Thank you, this was well explained & helpful :)

rosawolke
Автор

"if($password != $dbpass) {" you are using loose comparisons which might be still somehow vulnerable

sudoer
Автор

Why you dont close the php tag? <?php ?>

ArtieGamer