View Full Version : Password encryption.

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,

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'))";


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