RE: [PHP-DB] encode/decode

From: Date: Wed, 24 Jul 2002 20:13:50 +0000
Subject: RE: [PHP-DB] encode/decode
Groups: php.db 
Request: Send a blank email to php-db+get-20751@lists.php.net to get a copy of this message
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:gary.every@ingramentertainment.com http://accessingram.com -----Original Message----- From: Lisi [mailto:lists@shemeshdirectory.co.il] Sent: Wednesday, July 24, 2002 3:11 PM To: php-db@lists.php.net 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

« previous php.db (#20751) next »