
adolfo
Novice
Aug 29, 2001, 6:18 AM
Post #1 of 2
(366 views)
|
|
Problem when comparing encrypted passwords
|
Can't Post
|
|
Hello everybody !!! I made an administration script where I can change the users passwords and I made another script to control the users sesions. To create passwords I did this (in the admin script): $newpass = crypt($pass, aa); open (PASS, ">$user/password.txt"); print PASS "$newpass"; close (PASS); then in the access control script I made this to compare the password that the user wrote in the login form with the stored (and encrypted) password: open (CONTROL, "<$user/password.txt"); $passtxt = <CONTROL>; close (CONTROL); If ( crypt($formpass, $passtxt) eq $passtxt){ &ok; }else{ print "PASSWORD DOESN'T MATCH"; } The problem was that I always got the error PASSWORD DOESN'T MATCH so I made this to compare and to see the vars values: open (CONTROL, "<$user/password.txt"); $passtxt = <CONTROL>; close (CONTROL); $control = crypt($formpass, $passtxt) ; If ($control eq $passtxt){ &ok; }else{ print "PASSWORD DOESN'T MATCH"; print "control: $control - passtxt: $passtxt"; #If the error occurs again I would see the values } I got the same error and I saw that passwords were diferents. I don't know what's going wrong. I used a one letter password to ensure I was writing the correct password. Please help me!! thanks =) ~Adolfo~
|