titanic_fanataic has asked for the wisdom of the Perl Monks concerning the following question:
The database is a flatfile, and looks like this:
user1|cryptedpass1
This will be the only line in this password file as it's for the admin section.
Here is the code that I'm using to validate:
open(PASSWD, "$adminpasswddir/adminpasswd.db") || &dienice("Can't +open the file adminpasswd.db $!"); $admin_passwd = <PASSWD>; close(PASSWD); chop($admin_passwd); ($ausername,$apasswd) = split(/\|/,$admin_passwd); $test_passwd = crypt("$FORM{'password'}","k3"); if ($test_passwd eq "$apasswd" && $FORM{'username'} eq "$ausername +"){ &admin_main; } else { &dienice("Your username/password combination is incorrect. Ple +ase press your browsers back button and try again."); }
The problem that I'm having is that when I try to login, it says my password is incorrect. I noticed when putting some of the variables into the error page that when the script writes the password to the db it writes it as "k3LFRiJg/OOe" and when the script creates a variable with the entered admin password to be used to verify the password it creates a string which is identical with the addition of "Q" at the end "k3LFRiJg/OOeQ".
I know I'm not very advanced, but I just can't figure this one out I used the same line of code to create the password, so there should be no reason why this isn't working.
Thanks for all your continued support,
Titanic_Fanatic
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: username/password validation
by Errto (Vicar) on Dec 19, 2004 at 21:00 UTC | |
|
Re: username/password validation
by Cody Pendant (Prior) on Dec 19, 2004 at 23:05 UTC | |
|
Re: username/password validation
by titanic_fanataic (Acolyte) on Dec 20, 2004 at 01:19 UTC | |
by saskaqueer (Friar) on Dec 20, 2004 at 04:33 UTC | |
by superfrink (Curate) on Dec 20, 2004 at 07:02 UTC | |
by titanic_fanataic (Acolyte) on Dec 21, 2004 at 11:45 UTC | |
by titanic_fanataic (Acolyte) on Dec 20, 2004 at 07:38 UTC |