38 thoughts on “9. Forgot Account Password Form Email Script Ajax PHP MySQL Tutorial

  1. hi adam I have problem with login.
    this spell.

    Notice: Undefined variable: db_conx in C:xampphtdocschatuser.php on line 19

    Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:xampphtdocschatuser.php on line 19

    Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:xampphtdocschatuser.php on line 21

  2. Good tutorial but I would advise against telling them when they get a wrong email. Otherwise people could use this system to find out what emails are on the system, and which ones are valid and not valid. It helps the hackers. Best to give a message to say the email has been sent, but not give away if the email is really on the system.

  3. I copy/pasted everything into a new .php-file named "forgot_pass.php".

    I changed the sql strings and such to fit my exact tables .. however, when I click the button "genere tem log in password" nothing happens at all.

    What do I do?

    Also, how do I connect to my very own Database? I see db_conx but I'm not sure what to do with it.
    I have a dbconnect.php file, where I can connect to my DB. How do I implement it?

  4. Works perfectly till now. only problem is receiving the emails but I understand it is due to the SMTP not being available on my localhost. but soon i will migrate to a hosting service. and hopefully everything works fine.

  5. for me the unknown error was caused by having the page named /forgot_password.php and not /forgot_pass.php

    It fixed all my errors. I guess my mind defaulted to naming it the way I did.

  6. Thanks for the tutorial Adam.
    +Adam Khoury I cannot get this to even begin doing anything. I created the useroptions table. I want to note this first as I am not sure if it is causing this. I put all of your code into my file name called forgotpassword.php. I modified all of your code to reflect that. I did not put your <script src="js/main.js"></script>
    <script src="js/ajax.js"></script> files in mine as I am not sure what those contain or where to locate them. It seems like my issue starts right from the beginning. I enter the email adress and then click the generate temporary password button and nothing happens at all. What would be causing this??

  7. Man I am about to giving up on this page. I keep on getting no where with it. Now I get the link on my email but when I click on it. It gives me the error messages there is no match for that user and temporary password. Can anyone help

  8. Adam Khoury,

    Just wanted to say thanks for the videos, I've learned a lot by following along your series.

    I am having a issue with this code however. I've gone through the code line by line and I'm pretty sure I understand it however for some reason when I click on the Generate temporary password button all I get is please wait. It never goes any further. I never have a temporary password created in my db. Some assistance would be greatly appreciated.

  9. I dont receive the Temporary Password email, even though i get 'success' (Step 2. Check your email inbox in a few minutes You can close this window or tab if you like.) when i click the button. I checked the code but everything it seems to be ok. btw I do receive activation email sent by signup.php and i copied the mail structure from that and i paste it in my file but still doesnt work. can anyone help me?

  10. where did you learn this, i cant seem to find anyone to teach me php. i am in london now and the only college thats teachs php, only teaches for 4 weeks 2 hours every week, but i want to learn php so please tell me how you knew to play with php as good as u do. did u get taught and where please

  11. Thanks Adam, it works perfect! Just one little thing I'd change or improve would be, when you enter a non-existing email, you get the status "Sorry that email address is not in our system", and the "Generate Temporary Log In Password" BUTTON disappears, but it doesn't come back. It may confuse the user. So I added:
     _("forgotpassbtn").style.display = "block";
    Before:
    _("status").innerHTML = "Sorry that email address is not in our system";
    So it shows the error message, and the submit button too.

  12. I've got the same problem: "Unknown Error has occured". I also receive an e-mail with temp pass but the link to activate temp_pass as a main password doesn't open. Anybody knows how to fix it?

  13. I'm getting the "Unknown Error has occured" too. Although the temp password gets created and the email link swaps the password just fine. Anyone know what might be the problem?

  14. Hi Adam, thanks so much for this tutorial series! I now encountered the same problem as Ayush Sharma: "after I have click the email link of temporary password , it tells login unsuccessful, with new password but I can login with my old password". I checked in mysql myadmin that the temp pass is successfully generated in the useroptions table, and successfully gets deleted upon clicking the email link, however the original password from users table remains and does not get "overwritten" … please help? Thanks so much!

  15. For those having problems when being redirected from the email to forgot_pass.php [i.e. the page remains blanck not redirecting to login.php]: I made a separated forgot_pass_activation.php to process the temporary password activation. It seems to have solved the problem. (I copied the entire code for // EMAIL LINK CLICK CALLS THIS CODE TO EXECUTE in the forgot_pass_activation.php and updated the link in the $msg variable ). 🙂

  16. woah. a few years ago i was looking at code while inspecting an element. It made no sense. I thought the symbols and letters had no meaning. Now, after beginning to learn code it all clicks in. It makes so much sense. Code is so so so cool i feel like i could spend hours and hours and days just making a website… 😀

  17. I am guessing in your signup page, you still have the password being encrypted with crypt. he changes it to md5 in this video so make sure you change it as well.

Leave a Reply

Your email address will not be published. Required fields are marked *