Re: password() -mysql function with php

From: Date: Thu, 24 Apr 2003 00:30:57 +0000
Subject: Re: password() -mysql function with php
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-145099@lists.php.net to get a copy of this message
If you're trying to see if a given password matches the value in the database, do this: SELECT * FROM yourtable WHERE user = '$user' AND pass = PASSWORD('$pass') If you need to get the original password at some point, you might want to try either skipping PASSWORD() all together, or use MySQL's encode() / decode() functions. I really don't recommend doing either of those things though, since the first way is not secure at all, and the second way requires a whole other password just to encode and decode the value. Seems pointless. The best way to deal with users and passwords is to allow users to set their password once. If they forget their password, write something in PHP that generates a new password and e-mails the new password to them. -Jake "Jennifer Goodie" <goodie@apollointeractive.com> wrote in message news:NEBBIJJIKBGCCCNKMPBCMELDHDAA.goodie@apollointeractive.com... > You don't. PASSWORD() is a one way encryption. > > > -----Original Message----- > > From: Antti [mailto:antti@victoria.fi] > > Sent: Wednesday, April 23, 2003 2:28 PM > > To: php-general@lists.php.net > > Subject: [PHP] password() -mysql function with php > > > > > > How do I turn encrypted password created by password() -mysql function, > > back to it's real form 'qwerty'? I wasn't able to 'select' > > it from > > mysqldb as in this form. > > > > antti > >

« previous php.general (#145099) next »