SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast nguip's Avatar
    Join Date
    Apr 2001
    Location
    Malaysia
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi..

    I'm working on a membership management system based on Kelvin's tutorial (Thanks for the nice php tutorial!)

    However, I faced a problem in trying to retrieve the password from Mysql.

    As you see the password field had been encrypted in the database with the following code:-
    Code:
    INSERT INTO members SET password = PASSWORD('$newpass');
    It should be an easy task, but I'm about less then 1 week with php after reading kelvin's tutorial. Can anyone help me with this ?

    I tried below but it doesn't work
    Code:
    $userpass = mysql_result($result,0,"PASSWORD('password')");
    Thanks
    Ngu I.P.
    Web Developer

  2. #2
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As I understand, the PASSWORD function offers one way encryption. The whole point of it is that once used you can't decrypt stuff.

    If you want to check someone's password (for example when they enter a username and password in a form) you need to do this:

    SELECT * FROM users WHERE user_name = '$name' AND user_password = PASSWORD('$password')

    That's untested so I don't know if it'll work, but I'm pretty sure the theory is right

  3. #3
    SitePoint Enthusiast nguip's Avatar
    Join Date
    Apr 2001
    Location
    Malaysia
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are right. That's one kelvin used in his tutorial, and I tested that query it's working fine.

    But, Kelvin did mention that we can create a script to retrieve the encrypted password for the "forgot password" email.

    But he never told how... Can anyone help ? I need this function to work.

    Thanks
    Ngu I.P.
    Web Developer


Bookmarks

Posting Permissions

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