CodeIgniter Forums
Password Trouble - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Password Trouble (/showthread.php?tid=29700)



Password Trouble - El Forum - 04-18-2010

[eluser]$ilovephp[/eluser]
Last Friday, I posted a thread that has a problem with auto-encryption of password.

Here's the scenario:

I am working with INSERTION of user data into the database with fields username, email and password. To retrieve the values entered by the user i used the INPUT CLASS (inside controller):
Code:
$user_profile = array(
'username'=> $this->input->post('reg_username'),
'password' => $this->input->post('reg_password'),
'email' => $this->input->post('email')
);

and do the insertion at class that extends model:

Code:
function add_user($user_profile)
{
$this->db->insert('exp_jtb_users', $user_profile);
}

I did this code in the office, but the problem now is that the above code really inserted a record to the database, BUT, the password field (AND ONLY THE PASSWORD FIELD) is encrypted although i did not use an Encryption class nor attempted to encrypt the data.

To my surprise, i used the same code at home but it did not encrypt any field.

My question is, does it have to do with the server or the database? or it is more about on the codeigniter? Please help me out. Thanks and more power to CI developers!


Password Trouble - El Forum - 04-18-2010

[eluser]slowgary[/eluser]
Sounds like voodoo magic. Try it again. Smile


Password Trouble - El Forum - 04-18-2010

[eluser]$ilovephp[/eluser]
[quote author="slowgary" date="1271666122"]Sounds like voodoo magic. Try it again. Smile[/quote]

Is there something wrong with my code?? i've been trying this over again (took me 3 hours already)


Password Trouble - El Forum - 04-18-2010

[eluser]Bart v B[/eluser]
?? don't know what voodo there must be.. Only md5()

Code:
$user_profile = array(
'username'=> $this->input->post('reg_username'),
'password' => md5($this->input->post('reg_password')),
'email' => $this->input->post('email')
);

And it's done.. Wink


Password Trouble - El Forum - 04-19-2010

[eluser]$ilovephp[/eluser]
[quote author="Bart v B" date="1271673952"]?? don't know what voodo there must be.. Only md5()

Code:
$user_profile = array(
'username'=> $this->input->post('reg_username'),
'password' => md5($this->input->post('reg_password')),
'email' => $this->input->post('email')
);

And it's done.. Wink[/quote]

thanks! it really is about the md5. I fail to notice the md5 set at the configuration of my Form Validation Class.


Password Trouble - El Forum - 04-19-2010

[eluser]Bart v B[/eluser]
[quote author="$ilovephp" date="1271677570"]thanks! it really is about the md5. I fail to notice the md5 set at the configuration of my Form Validation Class.[/quote]

Do you have youre own form validation class? Can't find in the manual that there is an option to auto generate passwords. :red:
Besides from that, its just 5 characters typing, why would you atomate something like that Wink