How To Create Forgot Password System In PHP & MySQLi [2018]

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 272

  • @wiktorliszkiewicz354
    @wiktorliszkiewicz354 6 лет назад +2

    Yey another nice tutorial from Senaid.
    Btw as of PHP7.2 we can use also ARGON2 hashing algorithm. Here is an example:
    password_hash('hereIsMySecurePassword', PASSWORD_ARGON2I, ['memory_cost' => 2048, 'time_cost' => 4, 'threads' => 3]);
    note that the options have different keys.
    ARGON2 works with password_verify() same as PASSWORD_BCRYPT no change needed here but
    It might became a PASSWORD_DEFAULT as of PHP 7.3 so it is worth knowing that unlike BCRYPT it takes more then 60 char in your MySQL table. So if anyone uses PASSWORD_DEFAULT
    better update your database column to VARCHAR(255) just for safety.

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад +1

      Thank you! :)
      I love your comments, they are so informative and I hope that others will read them and learn something from it. Even better, if they go and read more about those extra settings that you're showing here. :)

  • @ArmilDeSparta
    @ArmilDeSparta 5 лет назад +1

    Very clear explanation. Thanks a lot.
    I would also suggest removing the token once the link in the email is clicked so that the token can only be used once and must be used before the time limit.
    Edit: Thanks for the reply, I missed that part. Doh! Very complete and thorough.

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Thank you. Yes, I agree with you, token should be reset once we use it, and that is what I am showing at 35:10

  • @rumeshrthnayake8393
    @rumeshrthnayake8393 6 лет назад +6

    Never see such this kind of explanation even from my professor...no words to say Mr. Senaid

  • @nikhillingam4630
    @nikhillingam4630 5 лет назад

    thank youuuu so much i got my phpmailer working because of you.
    i have been seeing many videos working but none of them i coundnt get now i got it thanks a lottttttttttttttttttttttttttttttttttttttttttt

  • @weedsimp34
    @weedsimp34 5 лет назад +3

    Hello, Senaid! I'm not usually one to comment on RUclips videos, but I wanted to let you know that the work you're doing is incredible! I've taken advantage of the Black Friday special and I'm hoping someone will get back to me soon with username and password so I can start coding with you some more!

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Hey Catilin, thank you so much for nice words, and also for purchase of Web Development Accelerator.
      All login details have been sent, and I can see that the one for you has been sent on 29.11.2018, so please make sure that you check your inbox/spam folder again. If you still have any problem, feel free to reach out again and I will make sure that you get those.

  • @AntonioJosa
    @AntonioJosa 6 лет назад +2

    Hello Senaid,
    I'm from Brazil, country located on South America, a tropical country.
    I would like to thank you for your great videos.
    If you come to Brazil, please let me know, I'll be glad to guide you.
    Best Regards,
    Antonio Josa.

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Thank you so much, that is really an amazing offer, will keep it in mind!

  • @PanlasangMotour
    @PanlasangMotour 5 лет назад +1

    Demn... thank you because i never saw a tutorial like this very informative and easy to understand your tuts are beginner friendly like me

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад +1

      Thank you :)

    • @keaikitse
      @keaikitse 5 лет назад

      @@SenaidBacinovic why not reply to our comments

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      @@keaikitse are you sure? :)

    • @keaikitse
      @keaikitse 5 лет назад

      @@SenaidBacinovic yes you only reply to people who says thank you

    • @PanlasangMotour
      @PanlasangMotour 5 лет назад

      @@SenaidBacinovic Do you have a tutorial on how to use and integrate Progressive Web App / PWA using bootstrap or in a system like in a admin panel ? Thanks in advance :D

  • @DeanEman
    @DeanEman 6 лет назад +1

    heya Senaid, thank you for your videos. always straight to the point and very informative...

  • @hrithik4733
    @hrithik4733 6 лет назад +2

    This channel is perfect...♥️

  • @rasulali4690
    @rasulali4690 4 года назад

    Damn I'm so glad I've found your channel couple months ago. You make everything look so much easier. And your teaching skills are on point as well. So thank you very very much Senaid. Hope you are allright and you will continue filming tutorials for us - the brand-new web developers. Cheers

    • @SenaidBacinovic
      @SenaidBacinovic  4 года назад

      Thank you so much for the nice words. I will, for sure, soon!

  • @jay-rathod-01
    @jay-rathod-01 4 года назад

    man you are legend.

  • @baroiall9968
    @baroiall9968 5 лет назад +1

    Hi Senaid, I really like this video. Although there is a suggestion I can give you about generating random numbers for the token. The way you made token numbers is good, but a better way to get random numbers for the token would be to get the the user email, and attach it with the timestamp of when the "request password" button was clicked, and then put it in a sha1 or str_suffle function, so that way you don't have to write any random numbers..php will automatically create very unique encrypted random numbers based on the date and time the request was made.
    Thanks
    Love your videos

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Thank you for the suggestion. There are so many different, and much better ways on how to do it, but I guess the entire purpose of this video is not that, so I just decided to show quick simple way on how to do it manually, so that viewers learn that too.

  • @arifhussain-qx1ef
    @arifhussain-qx1ef 6 лет назад +1

    Another great tutorial

  • @AbhishekKumar-wo4zd
    @AbhishekKumar-wo4zd 6 лет назад +2

    I love to watch all video. Thank you so much for making great videos

  • @emregul6794
    @emregul6794 3 года назад

    thanks alot man even tho 3 years later still helpfull..

    • @taps09099
      @taps09099 3 года назад +1

      its working ??

    • @emregul6794
      @emregul6794 3 года назад

      @@taps09099 its working

    • @taps09099
      @taps09099 3 года назад

      Can i get the source code

    • @emregul6794
      @emregul6794 3 года назад

      @@taps09099 i translated whole thing to turkish i dont think you would understand a word of it bro, do it over and over it works trust me i wasted 2 days over it..

    • @SenaidBacinovic
      @SenaidBacinovic  3 года назад

      Glad it helped

  • @abidimarwen8351
    @abidimarwen8351 6 лет назад +1

    thank you, keep up the good work you are the best

  • @braidenmincey
    @braidenmincey 6 лет назад +2

    if you already have a user database for a social network site, do you create a new table for this or add the token and token expire to current database?

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад +1

      Braiden Mincey just add missing columns, there is no need for a new table :)

    • @ytuberytuber4464
      @ytuberytuber4464 6 лет назад

      Hello bro, can u show us, how to write a php installer for CMS?

  • @moldovandorin6187
    @moldovandorin6187 3 года назад

    that's a very good tutorial...thanks :)

  • @abhidita143
    @abhidita143 6 лет назад +2

    Plz make a video on letting user to choose the new password, Great work again!

  • @sasijarvis9467
    @sasijarvis9467 6 лет назад +1

    thank you sir such an wonderful explanation :D

  • @CLFhama
    @CLFhama 6 лет назад +1

    Thanks a lot for your amazing videos Senaid
    we hope you start with tutorials about AngularJs on your way of teaching cuz I'm still so confuse about it and I want to use it in new future projects
    :)

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад +1

      Thank you! I will definitely have some tutorials about Angular/React/Laravel. :)

  • @sajasmohammed913
    @sajasmohammed913 5 лет назад +1

    thank you so much

  • @lakimatah
    @lakimatah 5 лет назад +1

    Thank you so much sir!

  • @navinly1030
    @navinly1030 5 лет назад +1

    Thank you so much for your explanation but what is your data_type for token and tokenExpire sir?

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад +1

      My pleasure. If I remember correctly, token is VARCHAR(20), and tokenExpire is DATETIME

  • @herlambangherlambang2162
    @herlambangherlambang2162 5 лет назад +1

    Very clear explanation, thanks Mr. Senaid
    Would you create tutorial about codeigniter? because that's very interesting topic to discuss

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Thank you. I will have some tutorials in the future :)

  • @jojok.mikaka6955
    @jojok.mikaka6955 2 года назад

    Very good! but there are not a PDO version ?

  • @ak_rocks
    @ak_rocks 6 лет назад +1

    So good, clear, and informative! Thank you man.. keep it up.

  • @FW4lk3r
    @FW4lk3r 6 лет назад +1

    Nice video, continue your excelent job :D

  • @nikhillingam4630
    @nikhillingam4630 5 лет назад

    excellent, helpful !

  • @isuru1302
    @isuru1302 6 лет назад +2

    New tutorial 😍

  • @THEHISTORY_TV
    @THEHISTORY_TV 6 лет назад +1

    Thank you bro

  • @mahmoodkashmiri
    @mahmoodkashmiri 6 лет назад

    you are awesome!

  • @hamidi88habib57
    @hamidi88habib57 4 года назад

    exelint sir tnq

  • @Raj_Patel21
    @Raj_Patel21 6 лет назад +1

    Nice video... One criticism I have for your tutorials is that if you make the HTML and CSS (bootstrap) skeleton before recording video you can greatly reduce video length. I am talking about in general not for this specific video. And are you going to make tutorials on other web technology stacks? Keep it up man.. !!

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Raj Thank you! Yes, absolutely. :)

    • @Raj_Patel21
      @Raj_Patel21 6 лет назад +1

      Coding Passive Income I have edited the comment if you want to read. :)

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад +1

      Raj yeah, I can save a lot of time, but I remember that back in a day when I started I always hated when I see tutorial with a lot of the code where 80% is not explained, and that is reason why I started this RUclips channel and explain everything in details.
      Also, for those that don't need to see how to create design, they can easy skip that part, while others can see everything explained. :)

    • @Raj_Patel21
      @Raj_Patel21 6 лет назад +1

      Coding Passive Income ok Cool :)

  • @petersababa4871
    @petersababa4871 5 лет назад +1

    What if you want to update your password to a new password using forms.. how can you do it

  • @abhishekshah9075
    @abhishekshah9075 6 лет назад +1

    Bring more videos on Php . maybe an ecommece if you get enough time .

  • @alexisaddicted
    @alexisaddicted 6 лет назад

    Should you not encrypt also the e-mail when receiving the e-mail ? Suppose youre not using HTTPS and email can get spoofed with a man-in-the-middle on a shared wifi.

  • @samuellopez4257
    @samuellopez4257 5 лет назад +1

    Coding Passive Income,
    When you set the database token equal to ' ', you allow anyone to access the reset password page. A user can access it with a url and have parameters of token = ' ' and any email of their choosing. The database would also give them a match and then expose a new password to them. The problem arises because of the isset( ). The isset( ) function returns true on token = ' '. Maybe the empty( ) function might work to validate the GET inputs.

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад +1

      Hey Samuel, I appreciate your comment and detail explanation about the problem that you have found. However, if you check the SQL query down below, you can see that I am also checking for " token '' ", which means that we are not allowing someone to change the password if token is empty. :)

    • @samuellopez4257
      @samuellopez4257 5 лет назад +1

      @@SenaidBacinovic,
      You're right bro. Good videos by the way

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Thank you!

  • @essentialedm937
    @essentialedm937 6 лет назад

    Fairly good tutorial although a few things in php have changed since this video so not everything worked right of the bat. E.g. Substr doesn’t use the ‘start:’ or ‘length:’ words, it just needed the values.

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Thank you! Well, substr() never needed those "start or length", basically that's just added by PHPStorm that I am using to make my work easier (so that I know what are the parameters for the function), and you shouldn't write that in the code.

  • @keaikitse
    @keaikitse 5 лет назад +1

    can you provide details of Adminer values of password,token,& token expire the name I know ID its an int type with 13length

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад +1

      Password - varchar 255
      Token - varchar 20
      TokenExpire - datetime

  • @mohamedalisaifelnasr565
    @mohamedalisaifelnasr565 4 года назад

    Thanks ♥

  • @vasifhummetov5400
    @vasifhummetov5400 6 лет назад +1

    very cool!

  • @WanderwithAkshayVerma
    @WanderwithAkshayVerma 6 лет назад +2

    I was expecting to see video on php composer how long will I have to wait for it bro?

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад +2

      a.v web studio I will give my best to publish it next week, sounds good?

  • @r_s_steam_cr
    @r_s_steam_cr 5 лет назад

    Gracias!!!

  • @rafaelpangilinan6432
    @rafaelpangilinan6432 6 лет назад

    Hi!! I am using MACOS. Is the PHPMailer compatible with it??? I am not receiving any email :(

  • @oluwadamilareatoyebi2977
    @oluwadamilareatoyebi2977 4 года назад

    Hello Mr. Senaid, great job sir.
    I am having problem though sending the mail out, whenever I click the reset button, I keep getting this error note: 'Something Wrong Just Happened! Please try again!'. I tried echoing '$mail->ErrorInfo' and the output was "Could not instantiate mail function." please help!

  • @johnreydalangin6892
    @johnreydalangin6892 5 лет назад

    Very informative tutorial sir. I just noticed that after a user reset his password, the password table is long and different to the given new password.
    Will it still log-in with your credentials?
    Btw, im just starting to learn php so no @
    Thank you so much sir. Godbless

    • @johnreydalangin6892
      @johnreydalangin6892 5 лет назад

      In database*

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад +1

      If you created the same way I did it, it should work. The string in database is encrypted, so make sure that it doesn't confuse you.

    • @johnreydalangin6892
      @johnreydalangin6892 5 лет назад

      Thank you so much sir.
      I was also working for the same system and it works on phpmailer. But just a thing in my work, after a user change his password, they credentials they input are invalid.
      Btw, i didnt used tokens, does it matter?
      Thank you again for response sir.

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      As long as you use same encryption method for your password and store it in the database, it should work. It's very hard for me to tell what exactly is the problem until I really see your code. Can you show me here your login and resetPassword code?

    • @johnreydalangin6892
      @johnreydalangin6892 5 лет назад +1

      Nevermind sir. I'll just do it your way. I think your method is quite easier than mine.
      Btw, this video is a great tutorial for me as a beginner sir. Thank you for continuous reply on my inquiry. More subs coming ♥

  • @jcmadetaydon
    @jcmadetaydon 5 лет назад

    Sir, having the password display in browser is bad security practice, people might be able to see it, is there a way that I can get the password to show in email instead please sir?

  • @salmaahmed8201
    @salmaahmed8201 5 лет назад +1

    it also doesn't show the messages such as please check your inputs etc. I'm confused I don't know where I went wrong

    • @arick9778
      @arick9778 3 года назад

      Did you figure this out bro? I have the same problem

  • @rudy1751
    @rudy1751 6 лет назад

    good sir, i need help, i kept fail to send the email eventhough i'm using both valid email, what should i do? iwas there any setup to connect the email or anything? thank you

  • @sayanchaudhuri1635
    @sayanchaudhuri1635 6 лет назад

    sir,what would be my domain name for this example if i am using Xampp for this example?

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      You can use your IP address OR even better watch my tutorial where I am showing how to use NGROK.

  • @nkosingiphiledlamini3477
    @nkosingiphiledlamini3477 6 лет назад

    sir id like to know where can i get the rest of the videos since i dont even know the database membershipsystem came from how was it created the whole login setup please and thank you

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      In this video, I do not talk about membership system, and I assume that you already have some login system in place, but if you don't just watch some of my videos on this channel on how to create one. :)

    • @nkosingiphiledlamini3477
      @nkosingiphiledlamini3477 6 лет назад

      Thank you senaid ill download all the videos from the beginning ive managed to sort out the error

  • @luckynath9929
    @luckynath9929 6 лет назад

    can you make video on forgot password system using token and user itself create or reset his/her password.

  • @izayoinikki9275
    @izayoinikki9275 6 лет назад

    Sir how about coding on register user? What shoud i declare about token and token expire?

  • @weilunlee3082
    @weilunlee3082 6 лет назад

    hi can i use localhost to do this? or do i need server

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Yes, you can use localhost, but make sure that there isn't something that is blocking email sending.

  • @hanumanhanu1580
    @hanumanhanu1580 6 лет назад

    should i put all this under a form. My button is not working

  • @salmaahmed8201
    @salmaahmed8201 5 лет назад +2

    Hello, I have followed every code but whenever I hit "reset password" nothing happens

    • @keaikitse
      @keaikitse 5 лет назад

      down vote his video for not replying

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад +1

      Salma - please check your console log, there has to be some error.
      Keaikitse - I am not obligated to answer, and still I answer 99% of comments, but yes, it takes time for me to answer all of them since I run 2 companies and do RUclips thing in my free time, and on average get about 40 comments each day + emails. ;)

  • @TheSakyun
    @TheSakyun 6 лет назад

    Should make a tutorial with PDO

  • @shaheryar8603
    @shaheryar8603 6 лет назад

    i have just copied your files, made no mistake at all. changed mysqli user name password and database name correctly. no error. but eventually my reset password button is not working at all. its doing nothing, what is the problem i dont know.. i have wasted 4 hour to find out the problem but i could not. please suggest me what should i do

    • @HenryWatters
      @HenryWatters 5 лет назад

      in forgotPassword.php file at the js script change this $(document).ready(function () {
      $('.btn primary').on('click', function () { TO $(document).ready(function () {
      $('.btn').on('click', function () {
      the only change i made was removing .btn primary to only .btn
      So try it i had similar issue

  • @miragliayt7522
    @miragliayt7522 6 лет назад

    Hello, i have a problem. When i use the Mailer i got a blank screen without errors. I enabled error reporting but nothing happens.
    use PHPMailer\PHPMailer\PHPMailer;
    require_once "phpmailer/PHPMailer.php";
    require_once "phpmailer/Exceptions.php";
    When i delete these lines, the page loads fully. Can u help me?

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Do you have those files in "phpmailer" folder?

  • @WhizKalifa28
    @WhizKalifa28 5 лет назад

    Please help i get this error when i click the forgot password button
    {"status":0,"msg":"Something Wrong Just Happened! Please try again!!"}
    Im sure i did the procedure right and the codes. I dont know where i did wrong.
    The database's token and token expire where updated but no message was sent to my email and get the error instead. Please help!

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Have you done any investigation why email sending failed? Are you sending an email from localhost?

  • @jay-rathod-01
    @jay-rathod-01 4 года назад

    hello sir everybody doesn't own a domain so what should they do

  • @jerrellpunsalan7082
    @jerrellpunsalan7082 6 лет назад

    Keeps on echoing "Something wrong just happened, Please try again!". Please help me. I am using localhost.

  • @justineholic
    @justineholic 6 лет назад

    Where do you put the password of the email address that's supposed to send the email from? :O

  • @josephasuquo7897
    @josephasuquo7897 6 лет назад

    cool, i need a tutorial on forgot password without sending a confirmation link to the email. thanks

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      So, how you will verify that someone is not trying to scam you?

  • @intanhafizah9564
    @intanhafizah9564 5 лет назад

    Hi sir. Why am i getting the msg "Something wrong just happened", and not when the status =1? i used your code and just change the code according to my database.

    • @intanhafizah9564
      @intanhafizah9564 5 лет назад

      please somebody help me. I have to complete this ASAP.

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад +1

      Where do you get that problem?

    • @intanhafizah9564
      @intanhafizah9564 5 лет назад

      @@SenaidBacinovic when i enter the email to reset password, at the forgotPassword.php

    • @wuttyee6177
      @wuttyee6177 5 лет назад +1

      @@intanhafizah9564 please fill for mail $mail->setFrom("your sender mail", "name");

  • @testtest-zu9hu
    @testtest-zu9hu 6 лет назад

    what is the type of "tokenExpire" colomn in DB??

  • @mohitrathore8698
    @mohitrathore8698 6 лет назад

    when i click reset password...nothing work,gives no error but page still same.
    and i am linking this forget functionality to login authentication with email verification,which you had made earlier
    all the php page is working but this forgetpassword page is not working...help me

    • @HenryWatters
      @HenryWatters 5 лет назад

      have you gotten answer for this?

  • @harrisongreeves5697
    @harrisongreeves5697 6 лет назад

    Your link to the source code doesn't work for me, any alternatives?

  • @pedroginting1948
    @pedroginting1948 5 лет назад

    What the database strructure like tokenExpired(date/varchar/etc)

    • @keaikitse
      @keaikitse 5 лет назад

      this guy is cheating , I asked same question long time ago and he only reply to people who says thank you, that havent tested this

  • @AkunBaru-yv3ub
    @AkunBaru-yv3ub 4 года назад

    I have website created with php..but still no visitor? Why?

  • @THEHISTORY_TV
    @THEHISTORY_TV 6 лет назад

    How to set phpmailer in windows php sublime? Please reply

  • @theeyeinthesky357
    @theeyeinthesky357 5 лет назад +1

    Senaid pls can you show how to do this with form

  • @jcmadetaydon
    @jcmadetaydon 5 лет назад

    Hello sir, can this work for sign up and log in system from comment system with reply?

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Yes, it should work with (I guess) small modifications (like database/table/columns etc)

    • @jcmadetaydon
      @jcmadetaydon 5 лет назад

      @@SenaidBacinovic k, thank you sir, I was able to add it, but I am wondering if i can get password to show in email bc if password show in browser it would be bad practice, do you have any code suggestions?

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Yes, that is bad practice in most cases. Just watch any of my "PHPMailer" tutorials, and instead of showing the password, just send an email. :)

    • @jcmadetaydon
      @jcmadetaydon 5 лет назад

      @@SenaidBacinovic great thank you sir :D! if you are available do you think you can help me with the comment and reply system sir?

    • @jcmadetaydon
      @jcmadetaydon 5 лет назад

      @@SenaidBacinovic Also, when I get to the PHPMailer tutorial, do I implement the code into resetPassword.php

  • @gnaneshg7663
    @gnaneshg7663 5 лет назад +1

    (Something Wrong Just Happened! Please try again!) error it shows how can is solve it sir.what may be error

    • @olisakweifeanyi4996
      @olisakweifeanyi4996 5 лет назад

      are you running on a localhost?

    • @sharwansoekhoe8023
      @sharwansoekhoe8023 5 лет назад

      @@olisakweifeanyi4996 I have the same problem and I 'm running on localhost

    • @olisakweifeanyi4996
      @olisakweifeanyi4996 5 лет назад

      @@sharwansoekhoe8023 You have to set up your PHP Mailer to function well on your local Host...Or Kindly Put on a Live Server

  • @Kuminlul
    @Kuminlul 6 лет назад

    somehow even with source code it doesn't work for me it doesn't show the error messages or the success messages and i don't get a email but atleast i get the token and tokenExpire in my database

  • @hakimsouhily8908
    @hakimsouhily8908 6 лет назад

    hello from algeria my friend please have you a method for crypt the password i use md5 but i want like same XA6AG...... please help

  • @ccbelly
    @ccbelly 6 лет назад

    I'm using your source code, but I keep getting bounced back to the login page after clicking on the email link. I've verified that I am connected to the mysql database correctly, the token is being generated, and the token in the database matches the token in the email link. I am not getting any error messages on the site or in the error log. I believe I've narrowed the issue down to this bit of code:
    if ($sql->num_rows > 0) {
    $newPassword = generateNewString();
    $newPasswordEncrypted = password_hash($newPassword, PASSWORD_BCRYPT);
    $conn->query("UPDATE users SET token='', password = '$newPasswordEncrypted'
    WHERE email='$email'
    ");
    echo "Your new password is $newPasswordClick here to log in";
    } else
    redirectToLoginPage();
    I'm not sure what's causing the redirect. Can you tell me how can I troubleshoot this issue?

    • @aidynibrayev7730
      @aidynibrayev7730 6 лет назад

      please check conditional wrapping this if. There could be some problems in $_GET[' ']

    • @ccbelly
      @ccbelly 6 лет назад

      There are no issues with the conditional wrapping.
      After a lot of experimentation I've made some progress, though I am still not able to login after resetting the password. I've been able to get past the original issue by deleting "AND tokenExpire > NOW()" from resetPassword.php. I assume that issue is being caused by the set up of the tokenExpire column in the database, though I'm not sure how since there's no info about this in the video.
      The new issue is this: Clicking on the reset password link in the email takes me to the "Your New Password Is *******, Click Here To Log In" page, but when I copy and paste the new password into the log in page I get an error (Login failed. User or password is incorrect.), and am unable to log in. Something seems to be going wrong with the password encryption. Once again, I'm looking at the bit of code I posted originally.
      This is really frustrating. Any guidance would be appreciated.

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      I believe that you have an error in the last SQL query where we need to update the password in the database. Can you make sure that password is actually changed in the database?

  • @jaylordjl6337
    @jaylordjl6337 6 лет назад

    Seniad it says something wrong just happen whAT error do i have right now?

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Have you tried to investigate more why do you get that problem?

  • @jannreyvlogs2023
    @jannreyvlogs2023 6 лет назад +1

    what is the name of your code editor

  • @hsugeen8653
    @hsugeen8653 5 лет назад

    sir can u guide me to how to create that databse plss??

  • @zoraizali395
    @zoraizali395 6 лет назад

    Hi, when i click reset password,it gives me error "Something Wrong Just Happened! Please try again!", where is the problem? plz help.

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      When is that happening?

    • @ErgiLaze
      @ErgiLaze 6 лет назад

      I have the same problem... The token is is created and updated, but the email is not sent

    • @hisyamjufri
      @hisyamjufri 6 лет назад

      me too :"(

  • @qasimzia4
    @qasimzia4 5 лет назад

    hello Senaid ,
    Your explanation is wonderful
    can you tell me is that possible to use this code for localhost xampp
    how?

  • @henryswanson8633
    @henryswanson8633 6 лет назад

    Hi. Great tutorial CPI. Thanks. I'm having a problem where after I press the link which is sent to my email account, I get sent to a page displaying the following error - This page isn’t working. website.com is currently unable to handle this request. HTTP ERROR 500
    Anybody else experience this? I'm running on my live server and I can see the DB is populated.
    Many thanks.

    • @khurramshahzad9359
      @khurramshahzad9359 4 года назад

      Hey I'm getting the same problem. What is the reason?

  • @tarmizi3780
    @tarmizi3780 5 лет назад

    I have try this code and get "Something wrong" message and do not receive any email. Can you help please?

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Instead of:
      echo "Something Wrong"
      try
      echo $mail->ErrorInfo
      and see the reason why it fails.

    • @tarmizi3780
      @tarmizi3780 5 лет назад

      @@SenaidBacinovic I got this -> 'Could not instantiate mail function.'

  • @mrbread4859
    @mrbread4859 5 лет назад

    I have one question.How can we learn from the start about html,css and php

  • @arick9778
    @arick9778 3 года назад

    Does anyone have the source code for this please? None of the links work properly, they all just go to the channel's RUclips page or to another video

    • @SenaidBacinovic
      @SenaidBacinovic  3 года назад

      Check the link now.

    • @arick9778
      @arick9778 3 года назад

      @@SenaidBacinovic thanks dude, much appreciated 👍

  • @voncarlomonares2145
    @voncarlomonares2145 6 лет назад

    Please where is the database ? :) thank you in advance..

  • @aidynibrayev7730
    @aidynibrayev7730 6 лет назад

    My problem is not updated password and also token is not empty as in last step.

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Check your SQL query, there has to be something wrong.

  • @tahmidalaviishmam9847
    @tahmidalaviishmam9847 5 лет назад

    sir what are the data types of id , name , email, token & tokesn expire
    ?????????????????????????????

    • @keaikitse
      @keaikitse 5 лет назад

      lets dislike for not replying

  • @devdasdd2433
    @devdasdd2433 4 года назад

    no errors and no output, what may be the problem sir, plz reply

    • @SenaidBacinovic
      @SenaidBacinovic  4 года назад

      What is the difference between my and your code?

  • @keaikitse
    @keaikitse 5 лет назад

    source code is incomplete I dont see any php mailer or Json files

  • @garymelander
    @garymelander 5 лет назад

    Why on earth does this require jQuery? I mean why add to the complexity when you can call myql from PHP without it? Now I have more to learn than I want if I try to use this code. Also, I have a busy chat site and the pages are refreshed several times per minute, per customer. Loading a big library every click is not good for bandwidth, which is still not free.
    In a tutorial that has usable source code, you really need to avoid piling on the newbies.

    • @SenaidBacinovic
      @SenaidBacinovic  5 лет назад

      Hey Gary, I am sorry to hear that you didn't like the jQuery part, but obviously this tutorial is for learning purposes and I am trying to explain as many things as possible and to still create useful solution.
      Also, loading few extra KB is better than to have load entire page again on each form submit.

  • @hackerhubnft7675
    @hackerhubnft7675 4 года назад

    I copied source code and its not working . No erros no movement just freezed content

  • @hackerhubnft7675
    @hackerhubnft7675 4 года назад

    I guess people can just bruteforce the token . They can try every combination and the duration would be short because the token is small

    • @SenaidBacinovic
      @SenaidBacinovic  4 года назад

      It's important to learn the concept. The easy thing is to make longer token. :)

    • @hackerhubnft7675
      @hackerhubnft7675 4 года назад

      @@SenaidBacinovic alright :}

  • @henryswanson8633
    @henryswanson8633 6 лет назад

    Just an update - my problem was that I wasn't using the correct name for my table (doh!) . I am now getting a new password on my screen (however - that password is currently not working. I'll update this comment why I find out what I'm doing wrong.

  • @fabianft20
    @fabianft20 4 года назад

    pls need data base proyect.

  • @dexter4399
    @dexter4399 6 лет назад

    Why are you not allowing the user to set his own password?

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад +1

      Dexter The goal of this video was to show most important things how to do, and if you understand this it is easy to just show form to set new password or do anything else that current coder thinks is the best experience for customer.
      In all of my videos I am trying to give the best possible explanation for the problem that tutorial is fixing, so that is reason why I didn't do that, but great suggestion. Thank you.

  • @suhailshaikh1032
    @suhailshaikh1032 6 лет назад

    Something Wrong Just Happened! Please try again!
    could you tell me what i m missing.
    thanks!

    • @SenaidBacinovic
      @SenaidBacinovic  6 лет назад

      Instead of that message, try to put $mail->ErrorInfo and see what will happen.

    • @suhailshaikh1032
      @suhailshaikh1032 6 лет назад

      token number not showing in database
      what happened here?

    • @Kuminlul
      @Kuminlul 6 лет назад

      have the same problem it says: Could not instantiate mail function. when i echo $mail->ErrorInfo;

  • @92bronagh
    @92bronagh 6 лет назад

    Hi, when i click reset password, nothing works. It gives me no errors it just stays on the same page. I have also checked the source code and can't seem to figure it out. Can someone help please?