From 13f6b3d0be64c34e303793339a7f809dc4692184 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 13 Nov 1999 23:50:23 +0000 Subject: [PATCH] fixed little glitch --- C4/Security.pm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/C4/Security.pm b/C4/Security.pm index 599d207..e8dc0c6 100644 --- a/C4/Security.pm +++ b/C4/Security.pm @@ -67,27 +67,30 @@ sub Login { my $valid = "f"; &startint($env,"Logging In"); until ($valid eq "t") { - my ($reason,$username,$password,$branch) = - logondialog ($env,"Logon to System",\@branches); + my ($reason,$username,$password,$branch) = logondialog ($env,"Logon to System",\@branches); $username = uc $username; $password = uc $password; - my $query = "select * from users - where usercode = '$username' and password ='$password'"; - #sth->prepare($query); + my $query = "select * from users where usercode = '$username' and password ='$password'"; + $sth=$dbh->prepare($query); $sth->execute; + debug_msg("",$query); if (my $userrec = $sth->fetchrow_hashref) { + if ($userrec->{'usercode'} ne ''){ if ($branch ne "") { $valid = "t"; my @dummy = split ' ', $branch; - $branch = @dummy[0]; - $env->{usercode} = $username; - $env->{branchcode} = $branch; + $branch = $dummy[0]; + $env->{'usercode'} = $username; + $env->{'branchcode'} = $branch; } + } else { debug_msg("","not found"); } + } $sth->finish; } + $dbh->disconnect; &endint(); }