Re: Re: comparing a string to a password encrypted file in MySQL

From: Date: Fri, 23 May 2003 15:23:16 +0000
Subject: Re: Re: comparing a string to a password encrypted file in MySQL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148785@lists.php.net to get a copy of this message
Don, I haven't tried this in MySQL, but you could try something like this: select username, pwd as db_pwd, password("$php_password") as php_pwd where username="$username" You could then compare db_pwd and php_pwd, but you're still only selecting on username. --- Joaco <joaco182@hotmail.com> wrote: > You cant compare the plain text per se... > > what you need to do is encrypt the plain text using the same > algorithm and then compare the encrypted password to the encrypted > plain text. If you have a match, it is correct. > "Don" <donpro@lclcan.com> wrote in message > news:010401c3209b$5c49dc70$c889cdcd@enterprise... > Hi, > > I have a table holding usernames/passwords where the passwords > have been > one-way encrypted using the password() function. > > The user is entering his/her password in plain text. How do I > compare it > with the encrypted password field in my MySQL table? > > Caveat: I first want to retrieve the row based ONLY on the > username. Then, > I want to check if the password is correct. I can't seem to find > a PHP > equivalent of the MySQL password() function. > > Thanks, > Don > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.483 / Virus Database: 279 - Release Date: 5/19/2003 > > ===== Mark Weinstock mark_weinstock@yahoo.com *************************************** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. *************************************** __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com

« previous php.general (#148785) next »