Better Loggin #2
This commit is contained in:
parent
d9ca8fcb1a
commit
0ff234d61d
@ -26,7 +26,7 @@ class UserManager
|
|||||||
if ($user = Db::loadOne ('SELECT * FROM users WHERE LOWER(username)=LOWER(?)', array ($username))) {
|
if ($user = Db::loadOne ('SELECT * FROM users WHERE LOWER(username)=LOWER(?)', array ($username))) {
|
||||||
if ($user['password'] == UserManager::getHashPassword($password)) {
|
if ($user['password'] == UserManager::getHashPassword($password)) {
|
||||||
if (isset($rememberMe) && $rememberMe == 'true') {
|
if (isset($rememberMe) && $rememberMe == 'true') {
|
||||||
setcookie ("rememberMe", $this->setEncryptedCookie($user['username']), time () + (30 * 24 * 60 * 60 * 1000), str_replace("login", "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI'])), $_SERVER['HTTP_HOST'], 1);
|
setcookie ("rememberMe", $this->setEncryptedCookie($user['username']), time () + (30 * 24 * 60 * 60 * 1000), BASEDIR, $_SERVER['HTTP_HOST'], 1);
|
||||||
}
|
}
|
||||||
$_SESSION['user']['id'] = $user['user_id'];
|
$_SESSION['user']['id'] = $user['user_id'];
|
||||||
$page = "./index.php";
|
$page = "./index.php";
|
||||||
@ -64,11 +64,12 @@ class UserManager
|
|||||||
public function logout () {
|
public function logout () {
|
||||||
unset($_SESSION['user']);
|
unset($_SESSION['user']);
|
||||||
session_destroy();
|
session_destroy();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($_COOKIE['rememberMe'])){
|
if (isset($_COOKIE['rememberMe'])){
|
||||||
//unset($_COOKIE['rememberMe']);
|
unset($_COOKIE['rememberMe']);
|
||||||
setcookie ("rememberMe2", $this->setEncryptedCookie($user['username']), time () + (30 * 24 * 60 * 60 * 1000), '/vasek/home/', $_SERVER['HTTP_HOST'], 1);
|
setcookie("rememberMe", 'false', time(), BASEDIR, $_SERVER['HTTP_HOST']);
|
||||||
setcookie("token", "restt", time() - 36000, "/");
|
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user