...

View Full Version : Password encryption.



purush2purush
07-04-2007, 06:48 AM
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,
Pursush.

bcarl314
07-04-2007, 06:59 AM
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'))";


and



$sql = "SELECT * FROM users WHERE username='$username' and password=MD5('$password')";



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum