Welcome Guest, Not a member yet? Register   Sign In
A simple encoding password function problem
#1

[eluser]markanderson993[/eluser]
Hello there CodeIgniter experts. I have a simple function that encodes an inputted password ($this->input->post('password')) and returns the encrypted salted password. The problem I'm having is strange that when I log in with a salt of NCJ I can login (encoding worked perfectly and a couple functions later I'm logged in). But when a user with a salt of e[# they can't log in.

Here is my code for encoding the password. Does anyone have any idea why this is happening?

Code:
function _encode($username,$password)
      {
        $this->CI->db->where('user_name',$username);
        $get_user_row = $this->CI->db->get('user',1);
        
        if ($get_user_row->num_rows() == 1) // A user was found
        {
            
            $this->CI->db->where('user_name',$username);
            $get_user_row = $this->CI->db->get('user',1);
            $user_row = $get_user_row->row();
            
            $salt = $user_row->salt;
            
            $enc_password = md5(md5($password) . $salt);
            
            return $enc_password;
        }
      }

Any help is greatly appreciated. Thank you!!!

- Pianoman993


Messages In This Thread
A simple encoding password function problem - by El Forum - 02-19-2009, 09:45 AM
A simple encoding password function problem - by El Forum - 02-19-2009, 10:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB