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
28 class Sklad_Auth
extends Sklad_Auth_common
{
29 function check_auth($user, $pass) {
31 $LMS_CONFIG = (array)parse_ini_file('/etc/lms/lms.ini', true);
32 define('BACKEND_AUTH_MYSQL_HOST', $LMS_CONFIG['database']['host']);
33 define('BACKEND_AUTH_MYSQL_USER', $LMS_CONFIG['database']['user']);
34 define('BACKEND_AUTH_MYSQL_PASS', $LMS_CONFIG['database']['password']);
35 define('BACKEND_AUTH_MYSQL_DB', $LMS_CONFIG['database']['database']);
37 $dblink = @mysql_connect
(BACKEND_AUTH_MYSQL_HOST
, BACKEND_AUTH_MYSQL_USER
, BACKEND_AUTH_MYSQL_PASS
);
38 mysql_select_db(BACKEND_AUTH_MYSQL_DB
, $dblink);
40 mysql_query("SET NAMES utf8");
42 $lQ = mysql_query("SELECT id, name, passwd, hosts, lastlogindate, lastloginip FROM users WHERE login='".$user."' AND deleted=0");
43 $lA = mysql_fetch_array($lQ, MYSQL_ASSOC
);
44 @mysql_close
($dblink);
46 if(!is_array($lA)) return false;
48 if(crypt($pass, $lA['passwd']) != $lA['passwd']) return false;
50 $this->user
['name'] = $lA['name'];
51 $this->user
['id'] = $lA['id'];
52 $this->user
['gid'] = 0; //TODO: rights
This page took 0.365388 seconds and 4 git commands to generate.