LanceT Posted February 2, 2007 Share Posted February 2, 2007 Anyone have any code for a lost password script? Similar to what most forums have if their users lose their password (will generate a new random password and then is e-mailed to the user). Thanks. Link to comment https://forums.phpfreaks.com/topic/36742-lost-password-script/ Share on other sites More sharing options...
EKINdesigns Posted February 2, 2007 Share Posted February 2, 2007 I wouldn't do it this way. I would have them enter their email, send them an email with a verification link where they can set a new password. It avoids a lot of confusion. Link to comment https://forums.phpfreaks.com/topic/36742-lost-password-script/#findComment-175236 Share on other sites More sharing options...
LanceT Posted February 2, 2007 Author Share Posted February 2, 2007 I wouldn't do it this way. I would have them enter their email, send them an email with a verification link where they can set a new password. It avoids a lot of confusion. how would you do this ? ??? Link to comment https://forums.phpfreaks.com/topic/36742-lost-password-script/#findComment-175357 Share on other sites More sharing options...
obsidian Posted February 2, 2007 Share Posted February 2, 2007 To answer your initial question, have a user enter their email address (since, hopefully you're only allowing each email address to be used once), then run some sort of random password generator. Here's one that I've used in the past: <?php function generate() { $hash = md5(time()); return substr($hash, 0, ; } ?> Then, just set their password to that value, and then send them an email with the updated password. Of course, make sure you have them confirm at least once that they do want it reset before you use this method Link to comment https://forums.phpfreaks.com/topic/36742-lost-password-script/#findComment-175360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.