mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
New Api autentication token
This commit is contained in:
1 parent
e22d98cf6a
commit
a1337d795d
4 files changed
+109
-2
No files matched your search
@@ -65,6 +65,24 @@ class UserManager
|
||||
}
|
||||
}
|
||||
|
||||
public function loginNew ($username, $password) {
|
||||
try {
|
||||
if ($user = Db::loadOne ('SELECT * FROM users WHERE LOWER(username)=LOWER(?)', array ($username))) {
|
||||
if ($user['password'] == UserManager::getHashPassword($password)) {
|
||||
echo "user loged in";
|
||||
return $user['user_id'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch(PDOException $error) {
|
||||
echo $error->getMessage();
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
public function isLogin () {
|
||||
if (isset ($_SESSION['user']) && isset($_SESSION['user']['id'])) {
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user