How to create PHP function to recover password?

Asked

Viewed 254 times

6

I use 2 pages, one to insert the email (forgotPassword.php) that still only has graphic design. And the recuperar.php which will serve for the user to change his password.

My user table (where the registered staff go) has the columns ID, Nome, password, Email, Telemovel, and idUtilizador.

I need a PHP function that restores the user’s password and allows you to change it.

PS: My database is Mysqli.

  • 2

    Post an example of what you tried.

  • @Guilhermelautert correct expression. No syntax errors.

  • I tried several tutorials on google, I will not put here all the ways I tried...

  • User table does not have password column?

  • 3

    You should develop a script for this, there is no tutorial that will tell you how to do it. On the page recuperar.php should receive at least the email, you need to check if it exists in the database. If it exists you send an email to it with a page created to generate new password. It would be important to generate a maturity hash of the url you will check when opening and on this screen you should allow it to change the password. As our colleague Wallace said, you should create the logic that best suits your problem solution.

  • Hmmm understood... What code is used to send emails?

  • @Bruny take a look at this tutorial -> http://blog.thiagobelem.net/enviar-e-mails-pelo-php-usando-o-phpmailer/ is well explained and simple to understand.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.