+
+sub check_password {
+
+ if ($myconfig{password}) {
+
+ require "$form->{path}/pw.pl";
+
+ if ($form->{password}) {
+ if ((crypt $form->{password}, substr($form->{login}, 0, 2)) ne $myconfig{password}) {
+ &getpassword;
+ exit;
+ }
+ } else {
+ if ($ENV{HTTP_USER_AGENT}) {
+ $ENV{HTTP_COOKIE} =~ s/;\s*/;/g;
+ %cookie = split /[=;]/, $ENV{HTTP_COOKIE};
+
+ if ($form->{action} ne 'display') {
+ if ((! $cookie{"SQL-Ledger-$form->{login}"}) || $cookie{"SQL-Ledger-$form->{login}"} ne $form->{sessionid}) {
+ &getpassword(1);
+ exit;
+ }
+ }
+ }
+ }
+ }
+}
+
+