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
In reply to Re: username/password validation
by titanic_fanataic
in thread username/password validation
by titanic_fanataic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |