Forum Moderators: coopster
$passwd = crypt('$pass' , '$1$d4juhy6d$');
all is fine, passwd is stored in encrypted form in database
but when i'm try to check it wid the passwd entered by the user while login.. it creating problems
here is the code...
if(crypt('$pass', '$rs')=='$1$d4juhy6d$')
{echo 'gud';}
else
{echo 'bad';}
----------------------------------------------
i tried this also
if(crypt('$pass', '$1$d4juhy6d$')=='$rs')
{echo 'gud';}
else
{echo 'bad';}
$rs=retrieved passwd frm the database
$pass=passwd entered by the user
$1$d4juhy6d$ is the encryption code for md5
Please suggest!
Thanks in advance
Anand
$passwd = crypt('$pass' , '$1$d4juhy6d$');
$passwd = crypt($pass , '$1$d4juhy6d$');
if(crypt('$pass', '$1$d4juhy6d$')=='$rs')
This isn't going to work because of the single quotes that you are using with the variable $pass and $rs. Try the following and see if it helps:
if(crypt($pass, '$1$d4juhy6d$') == $rs)
Notice the placement of the single quotes I have there.
Also for additional information about strings, you can refer to the documentation here: [php.net...]
[edit]
Too slow ;)
echo crypt($pass, '$1$d4juhy6d$');
echo $rs;
See if there is anything that doesn't belong there or perhaps if there is anything else that doesn't seem like expected behavior.