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