Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Password encryption.
07-04-2007, 06:48 AM #1
- Join Date
- Jul 2007
- Thanked 0 Times in 0 Posts
I have created a user registration form. When the user registers and click on submit button, all the data is stored in MySql tables.My code is working fine up to this.
My problem is the Password entered by the user is visible in the tables.(In form while entering the password it is of type (*******)..)That means in case if the users passoword is "PASSWRD" , it is exactly visible in database tables.
Now how can i make it not visible in exact form in tables.
To make so , what shud i do??
I will be greatful if i receive any help ..
Thanks & regards,
07-04-2007, 06:59 AM #2
- Join Date
- Jun 2002
- Winona, MN - The land of 10,000 lakes
- Thanked 45 Times in 42 Posts
Store the password in the database as a hash value. You can do this by using either the PASSWORD or MD5 functions when inserting your data and retrieving data.
$sql = "INSERT INTO users (username, password) VALUES ('$username',MD5('$password'))";
$sql = "SELECT * FROM users WHERE username='$username' and password=MD5('$password')";