Re: Password decryption

From: Date: Sun, 17 Feb 2008 17:26:43 +0000
Subject: Re: Password decryption
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-44614@lists.php.net to get a copy of this message
On Feb 16, 2008 10:17 PM, Nasreen Laghari <nasreen_laghari@yahoo.com> wrote: > Hi, > > I'm junior in PHP and stuck on Encryption. > > I have encrypted password using SQL : > > $query = "insert into user (userid,password,) values > ('$username',Password('$pass'));"; It's a one-way encryption method, so you won't be able to see the plain-text equivalent of the password again, but you can use this when testing a login: SELECT * FROM user WHERE userid='".$username."' AND password=PASSWORD('".$pass."')"; Also, to correct your $query above, some things to note: PASSWORD is a reserved word in MySQL, so you shouldn't name any columns or databases as such. You have a comma after userid,password, in your column bracket. With PHP, you shouldn't end your MySQL query with a semicolon. The code needs it to terminate the line, the query doesn't. -- </Dan> Daniel P. Brown Senior Unix Geek <? while(1) { $me = $mind--; sleep(86400); } ?>

« previous php.db (#44614) next »