Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 31st July 2007, 10:48
knight_killer knight_killer is offline
Junior Member
 
Join Date: Jul 2007
Posts: 8
Thanks: 1
Thanked 1 Time in 1 Post
Question MySQL Mailpassword Issue - Virtual Users And Domains ... Ubuntu

Hi,

I have a working Insallation of this howto: http://www.howtoforge.com/virtual_po...er_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
Quote:
ENCRYPT(str[,salt])

Encrypts str using the Unix crypt() system call and returns a binary string. The salt argument should be a string with two characters. If no salt argument is given, a random value is used.
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
Reply With Quote
Sponsored Links
  #2  
Old 9th August 2007, 08:29
knight_killer knight_killer is offline
Junior Member
 
Join Date: Jul 2007
Posts: 8
Thanks: 1
Thanked 1 Time in 1 Post
 
Default

Quote:
Originally Posted by knight_killer
What is the right "salt" Value to get always the same output as the system crypt() function?
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)))
Reply With Quote
The Following User Says Thank You to knight_killer For This Useful Post:
falko (10th August 2007)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 6.10 Edgy Eft) jhdtolentino HOWTO-Related Questions 6 22nd June 2007 03:23
Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 6.10 Edgy Eft) Aurora HOWTO-Related Questions 1 18th June 2007 11:29
Virtual Users And Domains With Postfix, Courier And MySQL - SASLauthd problem qtx HOWTO-Related Questions 7 22nd May 2007 18:19
Problem with Virtual Users And Domains With Postfix, Courier And MySQL Howto fenix Server Operation 4 11th March 2006 02:53
Another Problem: Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP bluegrass Installation/Configuration 24 8th March 2006 01:41


All times are GMT +2. The time now is 02:38.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.