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;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.