I am using sha1 encryption for encrypting my password, but I am facing problem with that. For some users, login is not working.
my code,(in sign up)
// all validation is done here
$password = sha1($_POST['password']);
// inserting data is here
in login my query is
$email = $_POST['email'];
$password = sha1($_POST['password']);
select * from users where email = $email and password = $password and status = 1 and deleted = 0;
one of the user facing problem with password,
im$$man
Am I doing some thing wrong.
please help me.
Well the problem is here,
sha1 treats $man
in im$$man
as variable, so it will be evaluated as null since you dont have any value for that.
some thing like this,
sha1("im$$man");// will echo 17cf5ec2752a9a7f0077c904f60b64f23ba2534d
is also equal to
sha1("im$");// will echo 17cf5ec2752a9a7f0077c904f60b64f23ba2534d
$man is evaluated to null.
Output is same for both the input(input is different though)
To get expected result, avoid double quotes there,
sha1('im$$man');// this will give correct output
Output is
850caa44549443778fe005f466766d5d6d413692// correct output.
Similar problem with md5() here