• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i want my password to be md5 using the codes posted, after execution i checked db content and its not in md5 format

#1
[eluser]Alpha[/eluser]
i want my password to be md5 using the codes posted below, after execution i checked db content and its not in md5 format, is there something i missed? tnx

$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[passconf]|md5');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');

$this->db->query("INSERT INTO users (email, password) VALUES ('".$this->input->post('email')."', '".$this->input->post('password')."')");

#2
[eluser]jzmwebdevelopement[/eluser]
[quote author="anthar" date="1311511809"]i want my password to be md5 using the codes posted below, after execution i checked db content and its not in md5 format, is there something i missed? tnx

$this->form_validation->set_rules('password', 'Password', 'trim|required|matches[passconf]|md5');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');

$this->db->query("INSERT INTO users (email, password) VALUES ('".$this->input->post('email')."', '".$this->input->post('password')."')");[/quote]

Yes:

Have a read here: http://ellislab.com/codeigniter/user-gui...elper.html

#3
[eluser]Aken[/eluser]
It's also not recommended to use md5() to encrypt passwords: http://www.php.net/manual/en/faq.passwor...s.fasthash

#4
[eluser]InsiteFX[/eluser]
You need to hash and encrypt the password before you send it to the database!
When checking the entered password you need to do the same when checking it from the database.
Code:
// --------------------------------------------------------------------

    /**
     * _hash_password()
     *
     * Hashs and encrypts the users password using the set
         * config encryption key.
     *
     * @access    private
     * @param    string    - $password
     * @return    string
     */
    private function _hash_password($password)
    {
        return sha1($password . $this->config->item('encryption_key'));
    }

InsiteFX


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.