SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2003
    Location
    asdf
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql 4.1 password encryption HELP

    ok, i have this program that reads passwords out of the database;

    i use the password(blah) to put it into the database.

    now when i get it out in mysql 4.0 the code looks like the stuff below and it works perfectly fine. however i just installed mysql 4.1 and the password encryption is way different when you look at it in the database and when i go to get it out it doesn't work

    does anyone know what the difference is between this 2 versions in terms of decrypting the password function. based on my code below

    and below the code is how i add the database users

    ***************************************
    // Authenticate user
    $hDB = mysql_connect('localhost', 'username, 'password');
    mysql_select_db('cms', $hDB);

    $sQuery = "
    Select iUser, MD5(UNIX_TIMESTAMP() + iUser + RAND(UNIX_TIMESTAMP())) sGUID
    From tblUsers
    Where sEmail = '$psEmail'
    And sPassword = password('$psPassword')";

    $hResult = mysql_query($sQuery, $hDB);

    if(mysql_affected_rows($hDB)) {

    $aResult = mysql_fetch_row($hResult);
    ***************************************
    ***************************************
    INSERT INTO tblUsers Values
    (
    Null,
    'username',
    password('something'),
    Null,
    Null
    );
    ***************************************

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You shouldn't be using password():

    Quote Originally Posted by http://www.mysql.com/doc/en/Miscellaneous_functions.html
    The PASSWORD() function is used by the authentication system in MySQL Server, you should NOT use it in your own applications
    You should use something like MD5 - tutorial

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature


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
  •