hiepho
asked on
how to query and edit Password field
i have a simple table like this: name, address, email, password.
i insert records using password encryption like so ... PASSWORD('$password')
the password is "test" and it looks something like this "378b243e220ca493" when it is stored in mysql
i have an edit page and when i query a record the password field is displayed "378b243e220ca493". i want it to display "test" instead so that i can edit it.
i insert records using password encryption like so ... PASSWORD('$password')
the password is "test" and it looks something like this "378b243e220ca493" when it is stored in mysql
i have an edit page and when i query a record the password field is displayed "378b243e220ca493". i want it to display "test" instead so that i can edit it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"SELECT * FROM users WHERE username = '$username' AND PASSWORD = '" . encrypt($key, $password) . "'";
Then you can actually retrieve this data and decrypt it using the PHP function decrypt() that he defined above. You could decode passwords using a query like this:
"SELECT password FROM users WHERE [something something something]"
And then with the MySQL result, you could get the password like this:
$password = decrypt($key, $rowset[0]['password']);
--------------------------
But all-in-all, that's very complicated. To top things off, as tolgaong has already astutely pointed out, you'd have to make sure that your webserver supports the mcrypt_ functions in PHP. Why do you need to decrypt passwords anyway? It's MUCH simpler to just use one-way encryption and then forget about them.