SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mySql PASSWORD function

    If I send a users password to a database table using:

    PASSWORD('$userpwd');

    when they first register. If I want to check that that user and their password is valid at another login time will I just be able to compare the password they enter the next time they log on with the one in the database to authenticate them. If not how do I do the following:
    I want to store user's passwords encrypted in a database but I need to compare these encrypted passwords with user when they login at another time.
    Sorry if this sounds confusing.
    signature

  2. #2
    SitePoint Evangelist jkh1978's Avatar
    Join Date
    May 2001
    Location
    Northern Virginia
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    encrypt both

    When they log in next... encrypt the password they entered. Compare this encrypted password to the already encrypted password in your database.

  3. #3
    SitePoint Zealot Ace Nova's Avatar
    Join Date
    Aug 2000
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there are other functions other than password() that you could use
    like encode() and encrypt()
    Ace Nova
    Football Man
    InternetSprite.Com - Coming Soon!

  4. #4
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'd use PHP's or MySQL's md5().
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  5. #5
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I read the question correctly, you just need to do this:
    PHP Code:
    <?PHP
    $sql 
    "SELECT * FROM db.users WHERE password = PASSWORD('$pwd');"
    $result mysql_query($sql);
    ?>


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
  •