Welcome Guest, Not a member yet? Register   Sign In
Posting an ecrypted password to my model with ajax
#1

[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




Theme © iAndrew 2016 - Forum software by © MyBB