1 package C4::Security; #assumes C4/Security
8 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
10 # set the version for version checking
14 @EXPORT = qw(&Login &CheckAccess);
20 my $query = "select * from branches order by branchname";
21 my $sth=$dbh->prepare($query);
23 while (my $branchrec=$sth->fetchrow_hashref) {
25 fmtstr($env,$branchrec->{'branchcode'},"L2")." ".$branchrec->{'branchname'};
26 push @branches,$branchdet;
30 &startint($env,"Logging In");
31 until ($valid eq "t") {
32 my ($reason,$username,$password,$branch) = logondialog ($env,"Logon to System",\@branches);
33 $username = uc $username;
34 $password = uc $password;
35 my $query = "select * from users where usercode = '$username' and password ='$password'";
36 $sth=$dbh->prepare($query);
38 # debug_msg("",$query);
39 if (my $userrec = $sth->fetchrow_hashref) {
40 if ($userrec->{'usercode'} ne ''){
43 my @dummy = split ' ', $branch;
45 $env->{'usercode'} = $username;
46 $env->{'branchcode'} = $branch;
50 debug_msg("","not found");
63 END { } # module clean-up code here (global destructor)