Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Location
    India
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Password encryption.

    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.

  • #2
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    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.

    PHP Code:
    $sql "INSERT INTO users (username, password) VALUES ('$username',MD5('$password'))"
    and

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •