Make it easy on yourself:

$pw = md5($password);
$query = "INSERT INTO penpals (email, password, username) VALUES 
\"$email\",\"$pw"\,\"$username\")";
mysql_query($query);

$pw = md5($password);
$query = "SELECT email,password,username FROM penpals WHERE email=\"$email\" && 
password=\"$pw\"";
$result = mysql_query($query) or die(mysql_error());

rick
"People will forget what you said. People will forget what you did.
But people will never forget how you made them feel."
----- Original Message -----
From: "Vernon" <[EMAIL PROTECTED]>
To: <>
Sent: Monday, February 17, 2003 10:16 AM
Subject: [PHP] MD5 login troubles


Hey all,

I'm using the following code to save an MD5 password into a database along
with an unencrypted username and email address:

$insertSQL = sprintf("INSERT INTO penpals (email, password, username) VALUES
(%s, MD5(%s), %s)",

All seems to have worked well, the password is encrypted and so forth. I
have also attempted to use the following MySQL command to encrypt the
password and came up with the same result:

UPDATE penpals SET password = MD5(password) WHERE ID = 1

So the trouble seems to be with the login where I am using the following
code:

SELECT email, password, access FROM penpals WHERE email= '%s' AND password =
MD5('%s')

Am I missing something here? Am I some how double encrypting the password?
Is there a de-encrypt function or something I'm missing?

Thanks



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




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

Reply via email to