Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Login Using Crypt()

registration login

  • Please log in to reply
No replies to this topic

#1 Alhazred


    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 133 posts

Posted 22 December 2011 - 08:10 AM

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?
  • 0

Also tagged with one or more of these keywords: registration, login

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download