How To Create A Forgotten Password System In PHP | Password Recovery By Email In PHP | PHP Tutorial

How To Create A Forgotten Password System In PHP | Password Recovery By Email In PHP | PHP Tutorial

Dani Krossing

5 лет назад

211,419 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@DavidAshby1
@DavidAshby1 - 24.01.2024 18:38

After some time trying to work out what the issue was. If you are using recaptcha then in your naming convention, use underscroes and not hyphens in your filenames as the hyphen seems to mess with the feedback.

Ответить
@StannYo
@StannYo - 21.01.2024 20:42

Great tutorial, thanks for your work

Ответить
@HakanGalip
@HakanGalip - 10.01.2024 21:43

I like your teachings very much and i learned very much from you. But the login system and the forget password system has very dangerous mistakes. Your code is unsecure !!!!! I will again say, that i like your style how to teach very much....

Ответить
@nomad100hd
@nomad100hd - 04.10.2023 02:09

I know this is old and before I learned MySQL, but text doesn't seem like the appropriate data type.

Ответить
@lorenzoagostini7941
@lorenzoagostini7941 - 02.10.2023 17:07

Hi, not sure if someone will read this, but I didn't quite catch, where to put the $currentDate, in reset-password.inc.php, which he mentioned we should add because he forgot it.

Ответить
@jinsingh6260
@jinsingh6260 - 30.09.2023 14:09

Dani, after I completed all the steps and tested out, I got an error message saying undefined variable $sql ---> if (!mysqli_stmt_prepare($stmt, $spl)).

Ответить
@psychoop9713
@psychoop9713 - 28.09.2023 19:51

❤❤

Ответить
@niltonc.7333
@niltonc.7333 - 18.09.2023 19:12

nice video thanks! what is the IDE you using on this video?

Ответить
@andrewcuster6498
@andrewcuster6498 - 27.08.2023 10:43

I 'actually' went through this twice, thoroughly. The first time as show, then I learned the OOP login system, then I went through this again and put it into the OOP paradigm. I did take some time from step to step to make sure I had it right, but it really wasn't too hard either. Thank you, it gave the codeholic in me a🙂 good fix and a good step forward.

Ответить
@tomaszgasecki
@tomaszgasecki - 10.07.2023 16:53

Oldie but Goldie

Ответить
@devwithbrian1534
@devwithbrian1534 - 25.06.2023 14:48

Thanks Dani

Ответить
@orlandolajara2696
@orlandolajara2696 - 21.06.2023 20:22

Well it works, but then i can not login, with a wrong password message!! Then I can not login with the old one either!

Ответить
@peterdevtutorial5743
@peterdevtutorial5743 - 09.06.2023 14:33

The only challenge am facing is that the link for the password reset can only be send to Webmail server the reset password link can't be send to a Gmail and mostly people use Gmail so that was the challenge.

I love your tutorial and I have been following for long time. Thanks may Almighty God bless you. Like right now am in school and those things you are saying is same thing so I found it simple.

Ответить
@user-mf3kp4ec3k
@user-mf3kp4ec3k - 15.05.2023 13:03

Meaning if you can do this in MVC method?

Ответить
@fromsoftwareenjoyer457
@fromsoftwareenjoyer457 - 07.05.2023 23:27

Hey Dani i just wanted to say that i'm learning so much things from your videos, thanks for this awesome content!

Ответить
@fromsoftwareenjoyer457
@fromsoftwareenjoyer457 - 07.05.2023 23:10

I'm getting the "There was an error !" and it's due to the " if (!$row = mysqli_fetch_assoc($result)) {" anyone knows how to fix that ?

Ответить
@danielokuguni2145
@danielokuguni2145 - 21.04.2023 13:17

Hi Dani nice tutorial by the way. I keep getting a there is an error message after click the button click to receive password by mail. Any possible fix or solution or something I missed. Thanks

Ответить
@jawadmerwah1658
@jawadmerwah1658 - 13.04.2023 01:26

I took your code and I turned it in to oop with pdo it works actually but there is one thing you didn't mention, which is how to now the if the date has expired. could you explain that, please?

Ответить
@lahcenaouina
@lahcenaouina - 07.04.2023 21:20

Please can u do more tutorials like this it's really helpful , like e-store

Ответить
@lahcenaouina
@lahcenaouina - 07.04.2023 21:09

THank you so so much I learnt alot of things Clean Code THANK AGAIN ! Teacher

Ответить
@user-mf3kp4ec3k
@user-mf3kp4ec3k - 30.03.2023 12:31

This was great, would it be able to do this is OOP?

Ответить
@priyasrinivas1594
@priyasrinivas1594 - 12.03.2023 21:44

It's getting "there was an error" After clicking receive new password by email button
What should I do

Ответить
@passwordcloset
@passwordcloset - 07.03.2023 10:36

Hi, is the mail function going to work directly or i need to do something more to work. I get success message but no email was sent

Ответить
@devilsnevercry2188
@devilsnevercry2188 - 03.03.2023 03:58

i got this error could you help please ?
Fatal error: Uncaught ArgumentCountError: The number of elements in the type definition string must match the number
of bind variables in C:\xampp\htdocs\projet3\resetpass2.php:24 Stack trace: #0 C:\xampp\htdocs\projet3\resetpass2.php(24):
mysqli_stmt_bind_param(Object(mysqli_stmt), 's', '1677805010', '8f7fcc133bde7a7...')
#1 {main} thrown in C:\xampp\htdocs\projet3\resetpass2.php on line 24

this is line 24
mysqli_stmt_bind_param($stmt, "s" ,$selector,$currentdate);
mysqli_stmt_execute($stmt);
$result= mysqli_stmt_get_result($stmt);

Ответить
@UnicastProduction
@UnicastProduction - 06.02.2023 00:17

Hi Dani. Thanks for the great Tutorials. Just a few questions. When you check for errors in an IF first and stop executing when an error happen, why do you continue with an ELSE? It is not really necessary. Also why do you not use SWITCH-CASE instead of many IF-ELSE following each other?

Ответить
@ralphjosephjavier2386
@ralphjosephjavier2386 - 26.01.2023 15:21

can i use this for oop php? i mean pdo instead of mysqli?

Ответить
@joannegoffey8068
@joannegoffey8068 - 20.01.2023 22:12

😱🥺 whys my comment been deleted 😶😭 only asking for a bit more help :(

Ответить
@OpcodeSoftware
@OpcodeSoftware - 19.01.2023 20:12

Thanks for a wonderful tutorial once again Dani. I do have a couple of questions though ? 1. If you have a users table, why not just use that and the users email as a selector - rather than create a seperate table and generate a new selector - which is tied to the users email address anyway ? 2. Why the crypto-secure hashed token ? At the end of the day, the only person that gets to use this in order to reset the password is the person who has access to the email account. So if the email account is comprimised - the user has big problems anyway ?

Ответить
@larsharstadmehus8101
@larsharstadmehus8101 - 04.01.2023 18:23

This tutorial worked fine when I finally found out how to set up an email server using phpmailer and how to merge the codes from it properly into the script from your video :D

However, I needed to do one change: to replace your $newPwdHash variable with the original $password variable in the "mysqli_stmt_bind_param($stmt, "ss", $password, $tokenEmail);"-section (from reset-password.inc.php). Otherwise I would have to type in the hashed password stored in the database instead of the given password from user to log in. Any quickfixes for that? 🙂

Anyways, nice video and when replacing hashed with original pwd-variable it worked afterall and a thumbs up from me :D

Ответить
@pcprodoc
@pcprodoc - 12.12.2022 15:29

Very very useful Dani. Thank. I hope to impliment this on my site(s) soon. I still need a profile page yet.

Ответить
@tuggummi6916
@tuggummi6916 - 30.11.2022 23:16

I dont know if this works anymore, but I keep getting stuck on the error happening at line 33 in reset-password.inc.php. Your 33rd line...

If you could help me I'd very much appriciate that!

Ответить
@kgarvey2147
@kgarvey2147 - 28.11.2022 01:08

A great tutorial, well explained. The code I've patterned after yours fails at the point of fetching the row from the result object, and I've spent two days trying to figure out why. My error trapping shows everything is good up to the creation of the result object, but no row can be fetched. Since the table only has one row, and the result object instantiates without error, why can't I pull the row out of it? I've tried various mysqli_fetch alternatives. They all fail. I've researched the crap out this and nothing. Sure could use some help if you have any suggestions.

Ответить
@ankitkumardubey0095
@ankitkumardubey0095 - 26.11.2022 17:28

How cool is this tutorial. Paid stuff for free!!! Thank you Dani.

Ответить
@LouieB11
@LouieB11 - 09.11.2022 22:20

I must thank you for your generosity. I've been following your tutorials and like very much your method. Keep on that track!

Ответить
@Felix-pr2el
@Felix-pr2el - 27.10.2022 19:27

wait wait wait wait, 1800 seconds != 1 hour hehe its == 30 Minutes :)
but nevertheless he is actually the best programming teacher i know on here
thanks to you buddy, you make coding as easy as possible :)
love watching ur videos <3

Ответить
@Emil-ox2ge
@Emil-ox2ge - 24.10.2022 14:32

Mine keeps saying no token

Ответить
@BlueDolphinBlues
@BlueDolphinBlues - 15.09.2022 01:03

You need to write a book.

Ответить
@jayjaylordlordbeatboxchann226
@jayjaylordlordbeatboxchann226 - 02.09.2022 17:05

who got all the codes? help me pls
......... for my project

Ответить
@zahraa1984
@zahraa1984 - 23.08.2022 22:22

Thanks for the great tutorial as usual, one question do you have a tutorial on creating php shopping cart using MVC model?

Ответить
@edgarssva6359
@edgarssva6359 - 27.07.2022 22:48

make tutorial how to buy host, domain how to set those two up. How to use best email service to send pwd reset.

Ответить
@davotube2035
@davotube2035 - 18.07.2022 03:31

source code please

Ответить
@sziszibia
@sziszibia - 14.07.2022 09:49

Hello Dani and others. Could you please help me why my reset-password.php send me back to my index page when I submit the "send me new password" form? Something doesn't work, but I can't figure out whats the problem... :(

Ответить
@andrisb.
@andrisb. - 04.07.2022 14:32

This is the best tutorial! Very helpful!

Ответить
@jeremeh7516
@jeremeh7516 - 20.06.2022 15:59

Thank you sir for your tutorials, can your please create a tutorial where users communicate with each other via inbox chat sql and php??

Ответить
@user-vc8ky2vq2n
@user-vc8ky2vq2n - 02.06.2022 13:31

What should I replace o it can work with the PHPMailer?

Ответить
@zraudiovlogs7044
@zraudiovlogs7044 - 30.05.2022 13:44

Hi, i'm getting error Warning: hex2bin(): Input string must be hexadecimal string in Line 40
$tokenBin = hex2bin($validator); What could be the issue

Ответить
@celestusnyalugwe7943
@celestusnyalugwe7943 - 20.05.2022 14:28

An awesome video this is, and it is well explained.
however i did notice that so many people faced the challenge of "Please re-submit your reset request"; after inputting the new password and still no one has shared how they were able to overcome this.
It appears that no rows are being fetched from the database.
Could someone please help with this, so stuck 😅
This is what my code looks like to this point

else {
mysqli_stmt_bind_param($stmt, "ss", $selector, $currentDate);
mysqli_stmt_execute($stmt);

$result = mysqli_stmt_get_result($stmt);
if (!$row = mysqli_fetch_assoc($result)) {
echo "Please re-submit your reset request";

exit();
}

Looking forward to a good samaritans help please...

Ответить