3 * SkladovySystem - Storage management system compatible with LMS
4 * Copyright (C) 2011 Thomas Mudrunka
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * Trida zajistuje autorizaci vuci LMS
24 * @author Tomas Mudrunka
25 * @author Martin Krusinsky
27 class Sklad_Auth
extends Sklad_Auth_common
{
28 function check_auth($user, $pass) {
30 $LMS_CONFIG = (array)parse_ini_file('/etc/lms/lms.ini', true);
32 $dblink = @mysql_connect
($LMS_CONFIG['database']['host'], $LMS_CONFIG['database']['user'], $LMS_CONFIG['database']['password']);
33 mysql_select_db($LMS_CONFIG['database']['database'], $dblink);
35 mysql_query("SET NAMES utf8");
37 $lQ = mysql_query("SELECT id, name, passwd, hosts, lastlogindate, lastloginip FROM users WHERE login='".$user."' AND deleted=0");
38 $lA = mysql_fetch_array($lQ, MYSQL_ASSOC
);
39 @mysql_close
($dblink);
41 if(!is_array($lA)) return false;
43 if(crypt($pass, $lA['passwd']) != $lA['passwd']) return false;
45 $this->user
['name'] = $lA['name'];
46 $this->user
['id'] = $lA['id'];
47 $this->user
['gid'] = 0; //TODO: rights
This page took 0.302669 seconds and 4 git commands to generate.