in reply to username/password validation
here is the code that I am using to verify the admin:
sub verify_admin { my($admin_passwd,$ausername,$apasswd,$username); open(PASSWD, "$adminpasswddir/adminpasswd.db") || &dienice("Can't +open the file adminpasswd.db: $!"); $admin_passwd = <PASSWD>; close(PASSWD); chomp($admin_passwd); ($ausername,$apasswd) = split(/\|/,$admin_passwd); $username = "$FORM{'username'}"; my $cypassword = crypt("$FORM{'password'}","v6"); if ($cypassword eq "$apasswd" && $username eq "$ausername"){ &admin_main; } else { &dienice("Your username/password combination is incorrect. Ple +ase press your browsers back button and try again."); } }
And here's the code that's being used to write to the admin password file:
if ($FORM{'password'} eq "$FORM{'verifypassword'}"){ my $cpasswd = crypt("$FORM{'password'}","v6"); open(ADMINPASS, ">$adminpasswddir/adminpasswd.db") || &dienice("Ca +n't open the file adminpasswd.db $!"); print ADMINPASS "$FORM{'username'}\|$cpasswd"; close(ADMINPASS); open(USERS, "<$passwddir/users.db") || &dienice("Can't create the +file users.db $!"); close(USERS); print "Content-type: text/html\n\n"; #SUCCESS HTML } else { &dienice("Your passwords do not match. Please press your browsers +back button to fix the problem."); } exit; }
If you need to see a copy of the script in full for reference, it can be downloaded from HERE
Thanks again for all the help,
Titanic_Fanatic
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: username/password validation
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 | |
|
Re^2: username/password validation
by titanic_fanataic (Acolyte) on Dec 20, 2004 at 07:38 UTC |