Jump to content

Login Using Crypt()

- - - - -

  • Please log in to reply
No replies to this topic

#1
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
I'm trying to make a login system using crypt() function.
During the registration I put the password into the db processing it with this line before to store it
$password = crypt($_POST['password']);


Into the login function I compare the passwords in this way
//$pass is the one taken from the db
//$this->password is the one taken from the login form
if($pass == crypt($this->password,$pass))
It always results false.


I've tried to print both of the passwords and they are like this
$1$Tz0.gE..$Wg3sb2XtiyuN6kpU/Xt7    //$pass
$1$Tz0.gE..$Wg3sb2XtiyuN6kpU/Xt7C1  //crypt($_POST['password'],$pass)
They are the same, but to the 2nd, two characters are appended to the end, why that happens? How do I solve this problem?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users