Re: Password decryption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Feb 16, 2008 10:17 PM, Nasreen Laghari <nasreen_laghari@xxxxxxxxx> 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); } ?>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux