ona  18.1.1
About: OpenNetAdmin provides a database managed inventory of your IP network (with Web and CLI interface).
  Fossies Dox: ona-18.1.1.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

local.class.php
Go to the documentation of this file.
1 <?php
11 class auth_local {
12 
13  var $success = true;
14  var $founduser = false;
15  var $user = null;
16 
25  function auth_local() {
26  // the base class constructor does nothing, derived class
27  // constructors do the real work
28  }
29 
30 
31 
46  function checkPass($user,$pass){
47  global $onadb;
48 
49  list($status, $rows, $user) = db_get_record($onadb, 'users', "username LIKE '{$user}'");
50 
51  if (!$rows) {
52  $this->founduser = false;
53  return false;
54  } else {
55  $this->founduser = true;
56  $md5pass = md5($pass);
57  // check that the password is the same.
58  if($md5pass === $user['password']) {
59  return true;
60  } else {
61  return false;
62  }
63  }
64  }
65 
66 
67 
84  function getUserData($login_name) {
85  global $onadb;
86 
87  list($status, $rows, $user) = db_get_record($onadb, 'users', "username LIKE '{$login_name}'");
88 
89  if (!$rows) {
90  $this->founduser = false;
91  return false;
92  } else {
93  $this->founduser = true;
94 
95  // Update the access time for the user
96  db_update_record($onadb, 'users', array('id' => $user['id']), array('atime' => date_mangle(time())));
97 
98  // Load the user's groups
99  list($status, $rows, $records) = db_get_records($onadb, 'group_assignments', array('user_id' => $user['id']));
100  foreach ($records as $record) {
101  list($status, $rows, $group) = db_get_record($onadb, 'groups', array('id' => $record['group_id']));
102  $user['grps'][$group['name']] = $group['id'];
103  if ($group['level'] > $user['level']) { $user['level'] = $group['level']; }
104  }
105 
106  return $user;
107  }
108  }
109 
110 
111 }
112 //Setup VIM: ex: et ts=2 enc=utf-8 :
auth_local\$user
$user
Definition: local.class.php:15
$record
$record['display_name']
Definition: app_advanced_search.inc.php:12
db_get_records
db_get_records($dbh=0, $table="", $where="", $order="", $rows=-1, $offset=-1)
Definition: functions_db.inc.php:891
$status
$status
Definition: install.php:12
$onadb
global $onadb
Definition: 2-to-3.php:15
auth_local
Definition: local.class.php:11
auth_local\$founduser
$founduser
Definition: local.class.php:14
auth_local\getUserData
getUserData($login_name)
Definition: local.class.php:84
db_update_record
db_update_record($dbh=0, $table="", $where="", $insert="")
Definition: functions_db.inc.php:474
auth_local\auth_local
auth_local()
Definition: local.class.php:25
db_get_record
db_get_record($dbh=0, $table="", $where="", $order="")
Definition: functions_db.inc.php:708
auth_local\checkPass
checkPass($user, $pass)
Definition: local.class.php:46
date_mangle
date_mangle($time=-1)
Definition: functions_general.inc.php:1105
auth_local\$success
$success
Definition: local.class.php:13