Dear All,
I'm developing admin side of my website. Can someone guide me how to make use of encrypted password saving it in the database.
Best Regards
Dilbert137
encryted password in database
Moderator: General Moderators
-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius
When you create new user do
This will encode the password, and when you test the login input do
Note that if you provide Forgot Password feature you cannot send the password to the user email because this md5 encoding is irreversible, so you need to build script for resetting the password.
Code: Select all
INSERT INTO users SET username='$username', password = md5($passord)Code: Select all
SELECT COUNT(*) FROM users WHERE username='$username' AND password = md5($password)-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius
Hi miro_igov,
Thanks a lot for your counsel. It's working now. I have used AES_ENCRYPT instead but could have used MD5 but lack of time to write a decrypt coding I used AES. For anyone who wants to use it, here is the code to be applied.
AES_ENCRYPT(string, key);
AES_DECRYPT(crypted text,key);
Best Regards
Dilbert137
Thanks a lot for your counsel. It's working now. I have used AES_ENCRYPT instead but could have used MD5 but lack of time to write a decrypt coding I used AES. For anyone who wants to use it, here is the code to be applied.
AES_ENCRYPT(string, key);
AES_DECRYPT(crypted text,key);
Best Regards
Dilbert137
-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
There are other unidirectional encryption (hashing) algorithms available. MD5 has been weakened significantly in recent years, SHA1 is stronger, but again has been weakened in recent years. If you're running PHP 5.1+ you may have access to the hash() extension, which supports many. If not, there's also my SHA256 library. see signature for link
-
Dilbert137
- Forum Commoner
- Posts: 57
- Joined: Sat Jun 02, 2007 5:02 am
- Location: Mauritius