Kronus Posted October 10, 2007 Share Posted October 10, 2007 I am trying to link to different PHP WebScripts that I have purchased. One Script uses MD5 when it stores the password in the MYSQL Database. The other does not. I have found all the variables that need to be changed, but I need the code to read the md5 instead of a clear text password. Below is the login code for the site that is using plain text. Thanks in advance for the help. function run() { $user_id = isset($_REQUEST['user_id']) ? getSafeStr($_REQUEST['user_id']) : null; $email = isset($_REQUEST['Email']) ? getSafeStr($_REQUEST['Email']) : null; $password = isset($_REQUEST['Password']) ? getSafeStr($_REQUEST['Password']) : null; case "login_user": if(!$email || !$password) { return false; } $sql = " SELECT ID, Email FROM Profiles WHERE Email='".$email."' AND Password='".$password."' LIMIT 1"; $res = $this->db->query($sql); if(isset($res["id"])) { $_SESSION['user_id'] = $res["id"]; return array("status" => "login_ok", "user" => array("id" => $res["id"], "Email"=>$email, "Password"=>$password ) ); } else { return array("status" => "login_error"); } break; Quote Link to comment https://forums.phpfreaks.com/topic/72662-needed-help-with-converting-existing-code-to-use-md5-passwords/ Share on other sites More sharing options...
darkfreaks Posted October 10, 2007 Share Posted October 10, 2007 <?php "AND Password=MD5('$password')"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/72662-needed-help-with-converting-existing-code-to-use-md5-passwords/#findComment-366354 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.