Jump to content

password reset code.


hassank1

Recommended Posts

But what if the old password got forgotten. ;)

 

Generate a random hash like this:

<?php
   $s = "";
   for($i=0;$i<10;$i++) {
      microtime()*30000;
      $s .= chr(rand(0,255));
   }
   $randomHash = md5($s);
?>

Save that random hash in your database with the current unix time to limit it by 24 hours.

Send an email with the link to get a new password like... getnewpw.php?userid=4&hash=THE-RANDOM-HASH

Link to comment
https://forums.phpfreaks.com/topic/103437-password-reset-code/#findComment-529689
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.