Jump to content

Needed Help with Converting Existing Code to use MD5 passwords


Kronus

Recommended Posts

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;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.