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

    Hi,

    I have a working Insallation of this howto: http://www.howtoforge.com/virtual_postfix_mysql_quota_courier_ubuntu_edgy

    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:
    Code:
    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
    Code:
    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
    Roman
     
  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:
    Code:
    SELECT * FROM users WHERE (email='$email') AND (password=ENCRYPT('$pass', SUBSTR(password, 1, 2)))
     

Share This Page