avesdon
avesdon

Reputation: 1

PHP & HTML help for editing password because it is in MD5

I have build one edit form in HTML. I am accessing that value in PHP. There is one field PASSWORD. In which I have displayed password for edit which is in MD5 format and stored in mysql database. But when I am not changing it, it should be unchanged and should not be converted. Is there anyone who can help me ?

Upvotes: 0

Views: 493

Answers (4)

Naveen Kumar
Naveen Kumar

Reputation: 4601

MD5 is one way encryption, so you will have to ask the security question, if it is correct then ask him to provide a new password which you should encrypt using md5 and store in database.

Upvotes: 0

AndrewR
AndrewR

Reputation: 6758

Standard convention would be to leave the password field blank, with a message that says something like "Enter and confirm password to change it." Then on your form handler, if password is blank, don't update it in the database.

You should never display the MD5 encrypted password to the user.

Upvotes: 0

xatzistnr
xatzistnr

Reputation: 174

You should not display the password on the form anyway! You should just display a blank empty box. When the you post the form back on the server you should check if the $_POST['password']==null and NOT proceed with changing the password. If the user enters a password the you should md5 the value and store it. What i usually do is first send the user an email with a random password and ask him to change it the first time he enters it!

CHeers.

Upvotes: 1

xdazz
xdazz

Reputation: 160943

Rather than let the user edit their password, you should let them reset their password.

Upvotes: 1

Related Questions