CodeIgniter Forums
Posting an ecrypted password to my model with ajax - 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: Posting an ecrypted password to my model with ajax (/showthread.php?tid=27406)



Posting an ecrypted password to my model with ajax - El Forum - 02-09-2010

[eluser]keld[/eluser]
Hello,

So I have my user passwords encrypted in the database.
When the user enter his password in the input field to login, jquery grabs the value of the password field and post it to my model, then in my model I encrypt it and compare it to the password column in my db, is this a good way to do it?
Here is my code in the model where $p is the password received from ajax:
Code:
$cryptedP=substr(dohash($p),0,32);
$this->db->select('id_admin, username');
$this->db->where('username', $u);
$this->db->where('password', $cryptedP);
I'm still posting an un-encrypted password from ajax, shouldn't ajax sends the encrypted one already to my model or it's fine like this?
Is the only way to protect your post data is using https://?
I know my site is not a banking site but just wondering...

Thanks a lot