MySQL Mailpassword Issue - Virtual Users And Domains ... Ubuntu

Discussion in 'HOWTO-Related Questions' started by knight_killer, Jul 31, 2007.

  1. knight_killer

    knight_killer New Member


    I have a working Insallation of this howto:

    Well, I want to provide to the users a simple Webinterface to change their passwords. So I began to wrote a PHP-Script. To verify the logins I first execute this Statement:
    SELECT * FROM users WHERE (email='$email') AND (password=ENCRYPT('$pass'))
    The login always fails and I know why: Here a quote from the MySQL manual
    When I execute the following statement several times, then I get each time another value
    SELECT ENCRYPT( 'mysecretpassword' );
    Now the question: What is the right "salt" Value to get always the same output as the system crypt() function?

    thanks for help & greets
  2. knight_killer

    knight_killer New Member

    I Just figured out that the salt value is always the first two chars of the password...

    So with this statement it works:
    SELECT * FROM users WHERE (email='$email') AND (password=ENCRYPT('$pass', SUBSTR(password, 1, 2)))

Share This Page