1 package C4::Security; #assumes C4/Security
4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
21 # FIXME - As far as I can tell, this module is only used by the CDK
22 # stuff, which appears to be stillborn. In other words, this module
30 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
32 # set the version for version checking
36 @EXPORT = qw(&Login &CheckAccess);
40 my $dbh = C4::Context->dbh;
42 my $query = "select * from branches order by branchname";
43 my $sth=$dbh->prepare($query);
45 while (my $branchrec=$sth->fetchrow_hashref) {
47 fmtstr($env,$branchrec->{'branchcode'},"L2")." ".$branchrec->{'branchname'};
48 push @branches,$branchdet;
52 &startint($env,"Logging In");
53 until ($valid eq "t") {
54 my ($reason,$username,$password,$branch) = logondialog ($env,"Logon to System",\@branches);
55 $username = uc $username;
56 $password = uc $password;
57 my $query = "select * from users where usercode = '$username' and password ='$password'";
58 $sth=$dbh->prepare($query);
60 # debug_msg("",$query);
61 if (my $userrec = $sth->fetchrow_hashref) {
62 if ($userrec->{'usercode'} ne ''){
65 my @dummy = split ' ', $branch;
67 $env->{'usercode'} = $username;
68 $env->{'branchcode'} = $branch;
72 debug_msg("","not found");
84 END { } # module clean-up code here (global destructor)