tonoslfx
tonoslfx

Reputation: 3442

php Password textbox!

alt text

<input type="password" value="<?php echo md5($row['password']);?>">
<input type="password" value="<?php echo $row['password'];?>">

im trying to retrive the password from the database. In input box, i want it show, let say password : 12345, instead of MD5 version of 12345.

Upvotes: 0

Views: 8783

Answers (4)

ceejayoz
ceejayoz

Reputation: 180023

MD5 is not reversible, and you shouldn't autofill a password field for security reasons.

It's showing longer because MD5ed strings are always 32 characters.

edit: You also shouldn't use a reversible password storage method. Please see Jeff Atwood's "You're Probably Storing Passwords Incorrectly" post for details.

Upvotes: 8

Sarah
Sarah

Reputation: 513

If you md5() the password in the value attribute of the input field, it's going to be the 32-character string. If you don't want it to be the md5()'ed string in the value then don't md5() it.

Can you expand your code to show what's actually happening and what you're looking to achieve?

Upvotes: 2

David
David

Reputation: 218877

It's outputting the MD5 hash because you're telling it to do just that:

echo md5($row['password']);

On a more general note, however, please do not output passwords to the page. Never, ever do this. Don't even output the MD5 hash. Don't output anything about the password. You are essentially giving away passwords for anybody to see.

Also, don't store passwords in plain text either.

Upvotes: 4

Codler
Codler

Reputation: 11256

It isnt possable, md5 is only one-way encryption, you cant decrypt it unless you bruteforce.

Upvotes: -1

Related Questions