erm did a small amount
output database to view added basic filters improve bootstrap theming and positioning added pagination
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
require_once('UserDataSet.php');
|
||||
class User {
|
||||
protected $_username, $_loggedIn, $_userId;
|
||||
protected $_username, $_loggedIn, $_userId, $_accessLevel;
|
||||
|
||||
public function getUsername() {
|
||||
return $this->_username;
|
||||
@@ -16,11 +16,13 @@ class User {
|
||||
$this->_username = "None";
|
||||
$this->_loggedIn = false;
|
||||
$this->_userId = "0";
|
||||
$this->_accessLevel = null;
|
||||
|
||||
if(isset($_SESSION['login'])) {
|
||||
$this->_username = $_SESSION['login'];
|
||||
$this->_userId = $_SESSION['uid'];
|
||||
$this->_loggedIn = true;
|
||||
$this->_accessLevel = $_SESSION['accessLevel'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,13 +37,22 @@ class User {
|
||||
$this->_loggedIn = true;
|
||||
}
|
||||
}
|
||||
private function setAccessLevel($level) {
|
||||
$this->_accessLevel = $level;
|
||||
$_SESSION['accessLevel'] = $level;
|
||||
}
|
||||
public function getAccessLevel() {
|
||||
return $this->_accessLevel;
|
||||
}
|
||||
public function Authenticate($username, $password): bool
|
||||
{
|
||||
$users = new UserDataSet();
|
||||
$userDataSet = $users->checkUserCredentials($username, $password);
|
||||
$accessLevel = $users->checkAccessLevel($username);
|
||||
if(count($userDataSet) > 0) {
|
||||
$_SESSION['login'] = $username;
|
||||
$_SESSION['uid'] = $userDataSet[0]->getId();
|
||||
$this->setAccessLevel($accessLevel);
|
||||
$this->_loggedIn = true;
|
||||
$this->_username = $username;
|
||||
$this->_userId = $userDataSet[0]->getId();
|
||||
|
Reference in New Issue
Block a user