whitedragond Posted March 7, 2008 Posted March 7, 2008 Ok, here's what I'm trying to do. I have a separate page that users can enter in their email, password, etc and I'm trying to encrypt their plain text password and then add them to the customers table. I copied out the password encryption functions /**********************************************************************/ // Return a random value function tep_rand($min = null, $max = null) { static $seeded; if (!$seeded) { mt_srand((double)microtime()*1000000); $seeded = true; } if (isset($min) && isset($max)) { if ($min >= $max) { return $min; } else { return mt_rand($min, $max); } } else { return mt_rand(); } } // This function makes a new password from a plaintext password. function tep_encrypt_password($plain) { $password = ''; for ($i=0; $i<10; $i++) { $password .= tep_rand(); } $salt = substr(md5($password), 0, 2); $password = md5($salt . $plain) . ':' . $salt; return $password; } /**********************************************************************/ $customers_password = tep_encrypt_password('$customers_password'); I then add the info into the customers table. When I try to login, it errors Error: No match for E-Mail Address and/or Password. I then created a new account using OSCommerce, same password, then copy that new encrypted password into the user I created from another page and I am able to login just fine. It seems like the encryption isn't working for some reason or doing it incorrectly. Do you know why this is? thanks
Recommended Posts
Archived
This topic is now archived and is closed to further replies.