Try this syntax, it works for me
INSERT INTO users (name, password) VALUES ('$_POST[username]',
ENCRYPT('$_POST[password]','encrypt')
Explanation:
After VALUES, use
('variable', ENCRYPT('variable','key')
You've got it
('variable','ENCODE(variable,variable')
which makes the second entry actually a variable that contains
"ENCODE($_POST[password], encrypt)"
When you try to decode that, you'll get gobble-di-gook!
Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"
mailto:[EMAIL PROTECTED]
http://accessingram.com
-----Original Message-----
From: Lisi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 3:11 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] encode/decode
I am trying to use encode/decode to store passwords in a database and then
retrieve it to email to a user who has forgotten their password.
I am using the following code to encode the password:
INSERT INTO users (name, password) VALUES ('$_POST[username]',
'ENCODE($_POST[password], encrypt)')
This does enter a binary entry into the database, presumably the encoded
data.
I then tried to retrieve the password using the following:
SELECT username, DECODE(password, 'encrypt') as password from users
but all I got was gobbledygook characters.
What am I doing wrong?
Thanks,
-Lisi
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php