|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Help me on md5()
Please someone can help me about the md5() function?
I just don't know how to convert the password back to text. For instance, users signup and submit their password, then the password is encrypted into 32 characters and saved into database. How can I convert this incrypted password and then bring it back to the text to display on a form after users logged in? Thank you very much in advanced. |
|
#2
|
|||
|
|||
|
md5 is a one way function. This means you can't turn the data back into a readable string.
You need to use base64_decode and base64_encode if you want to do that. -- Wil Moore III www.wilmoore.com |
|
#3
|
|||
|
|||
|
look at next post for my reply...... double post by mistake
Last edited by Chunks : February 19th, 2003 at 10:02 PM. |
|
#4
|
|||
|
|||
|
Hi,
the md5() function converts a string or data file into 32 alphanumeric character representation, and as already mentioned you can't convert it back. what you can do though is compare two outputs to see if they are the same. i use this in my login system, i convert the password that the user enters in at point of login , then i check that against the already converted (md5()) password stored in my database. eg.. PHP Code:
hope this helps Regards Chunks |
|
#5
|
|||
|
|||
|
Thank you very much for all your help. I think there is no way that I can display the actual password in the Members Area everytime user login.
About this method, I don't know how to do it. Please be more detail. PHP Code:
Thanks |
|
#6
|
|||
|
|||
|
what he is saying is,....when you user was added/created you you stored an md5 password in your db right?
well do something like this,... PHP Code:
See where this is going?
__________________
-- Jason |
|
#7
|
|||
|
|||
|
Quote:
if is a conditional statement. If the condition returns true then the first block of code is run, else if the condition false the second block runs: for example if(dog == dog) { echo "dog is equal to dog"; } else { //this will not run } because dog equals dog, it will return true and run the code. |
|
#8
|
|||
|
|||
|
He is saying he wants to display the user's password after login.. that's deffinitly bad security wise..
Why bother using MD5 if your going to do that then? If you need to do it incase users forget there passwords, just write a script that will re-assign them a new password.
__________________
Eric Coleman - Co-Owner ZaireWeb Solutions eric.coleman@zaireweb.com http://sitemod.net - sitemodCMS Coming Soon! |
|
#9
|
||||
|
||||
|
The only way that you could encrypt the password and be able to decrypt it would either to write your own encryption algorythm that can be decrypted by another function you write, or, you can try using the mcrypt functionality: http://www.php.net/manual/en/ref.mcrypt.php
I can't see why you would really want to show the plain text password of a user, that's extremely bad security, unless you're using it for debugging, and even then you can just md5 the password and compare it to the database <as mentioned above> which would be a much better debugging method, that way you don't compromise the security of the users... |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Help me on md5() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|