This is a discussion on "PHP Forgot Password script" within the PHP Forum section. This forum, and the thread "PHP Forgot Password script are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
PHP Forgot Password script
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
PHP Forgot Password script
Im a newbie in PHP programming can anybody help me, just a simple PHP forgot password script and PHP change password.. any idea
thanks chrizlord Last edited by chrizlord; Aug 26th, 2006 at 01:00. |
|
|
|
#2
|
|||
|
|||
|
Re: PHP Forgot Password script
First off you should not be able to see the password because it's just that! So if the user forgets their password, what you should do is generate them a new temporary login which they then use to set their new password. A login script needs to process the form information, check the id and the MD5 hashed password against that held in the database and if they match, let the user in. The change password script is almost identical except that you require the user to enter both the old and the new password. Only if the old password, when given the MD5 treatment, matches that held in the database, do you accept the new password, give it the MD5 treatment and store it in the database. Lots of info can be found on http://php.net |
|
#3
|
|||
|
|||
|
Re: PHP Forgot Password script
Text deleted
Last edited by ukgeoff; Aug 31st, 2006 at 09:31. Reason: Do not advertise your services within the thread. |
|
#4
|
||||
|
||||
|
Re: PHP Forgot Password script
So extending on what ukgeoff had to say:
The forgot password script A form where the user can enter their username and email, when submitted the username and email would be compared to what's in the database, if correct a new password would be set for them and sent to their email address. You could also have a field in the database to mark this password as temporary - so they have to change it as soon as they first login with it. The change password script A from with 3 fields - old password, new password and confirm new password. When submitted, the old password (which would be secure hash algorythm (sha 1)encrypted - 160-bit as opposed to md5's 128-bit, so harder to crack), would be compared with the password stored in the database - if passwords match then the 2 new passwords would be compared. If the 2 new passwords match, then the new password would be encrypted (sha 1 again) and stored in the database. Let me know if you want examples. |
|
#5
|
|||
|
|||
|
Re: PHP Forgot Password script
helo
good day thanks for reply guys i rely appreciate it... can u give me some examples for forgot password and change password... thanks |
|
#6
|
|||
|
|||
|
Re: PHP Forgot Password script
This is my fogot password script.
The user has to enter their email address and a new password is generated and sent to their email address
|
|
#7
|
|||
|
|||
|
Re: PHP Forgot Password script
I think I tried to make the point before but I'll restate it. Do not save passwords in an 'as is' format. Always use the crypt() function to create a one-way password. This is what you store. When a person is required to enter a password, you take the password they have entered and the stored password, feed them into the crypt() function and if the value returned is the same as stored, then the password is valid. If you want to send a temp password to someone who has forgotten theirs or is registering for the first time, here's the code I use. It generates an 8 character mix of upper and lowercase letters.
|
|
#8
|
|||
|
|||
|
Re: PHP Forgot Password script
I used md5 to encrypt my passwords so the user can choose their password and it gets encrypted to a 32 character length password which is still valid.
With my forgot password the user is sent new random password which they can change to one they can remember and it get's encrytped using md5 |
|
#9
|
|||
|
|||
|
Re: PHP Forgot Password script
hello gud day!
thank you adrock and ukgeoff for the reply it realy helps me alot ive an idea already.. |
|
#10
|
|||
|
|||
|
Re: PHP Forgot Password script
Hi adRock,
Thank you first for the scripts. It is the one that I was looking for but only little problem is that after receiving the mail with new password when user log on to the site with the new password, it says that it can not find the user with specified password. Any idea what it might cause. Does it has any thing to do with database field propery? Do I need to make that filed as md5. I tried though but it still did not work. Your response would be much appreciated. Thanks again. |
|
#11
|
|||
|
|||
|
Re: PHP Forgot Password script
You need to change thge fields in your database
I will have a look at my database and see what fields are what and let you know. What fields have you set up in your database so i can compare Last edited by AdRock; Apr 30th, 2007 at 23:23. |
|
#12
|
|||
|
|||
|
Re: PHP Forgot Password script
But I think it is the login scripts that causing the trouble. Because it take the entered password from the user and does not convert to MD5 format when check with the database. So if you are so kind enough to post your login script so that I can get a better idea. I am posting my script see if you can find out any problem. But I am pretty sure it is my login scripts. I am giving it here.......
|
![]() |
| Tags |
| php, forgot, password, script |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Forgot password and Change password PHP script | Chono | PHP Forum | 4 | May 16th, 2008 09:13 |
| Password script needs refining. | liwolfbyte | JavaScript Forum | 4 | Sep 3rd, 2007 20:05 |
| Best script to create users for password protected pages? | vandiermen | PHP Forum | 3 | Apr 23rd, 2007 12:22 |
| PHP Forgot password script error | eddie | PHP Forum | 4 | Mar 4th, 2007 15:43 |
| Looking for EASY password protect script | Lchad | PHP Forum | 3 | Jan 28th, 2007 00:54 |