fix cookies
This commit is contained in:
parent
2ddaa38d6a
commit
93e2e04e98
@ -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['HTTP_REFERER'])), $_SERVER['HTTP_HOST'], 1);
|
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);
|
||||||
}
|
}
|
||||||
$_SESSION['user']['id'] = $user['user_id'];
|
$_SESSION['user']['id'] = $user['user_id'];
|
||||||
$page = "./index.php";
|
$page = "./index.php";
|
||||||
@ -62,7 +62,7 @@ class UserManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function logout () {
|
public function logout () {
|
||||||
setcookie ("rememberMe","", time() - (30 * 24 * 60 * 60 * 1000), str_replace("login", "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['HTTP_REFERER'])), $_SERVER['HTTP_HOST'], 1);
|
setcookie ("rememberMe","", time() - (30 * 24 * 60 * 60 * 1000), str_replace("login", "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI'])), $_SERVER['HTTP_HOST'], 1);
|
||||||
unset($_SESSION['user']);
|
unset($_SESSION['user']);
|
||||||
session_destroy();
|
session_destroy();
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ include_once './config.php';
|
|||||||
//setup
|
//setup
|
||||||
ini_set ('session.cookie_httponly', '1');
|
ini_set ('session.cookie_httponly', '1');
|
||||||
ini_set('session.cookie_domain', $_SERVER['HTTP_HOST']);
|
ini_set('session.cookie_domain', $_SERVER['HTTP_HOST']);
|
||||||
ini_set('session.cookie_path', str_replace("login", "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['HTTP_REFERER'])));
|
ini_set('session.cookie_path', str_replace("login", "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI'])));
|
||||||
ini_set('session.cookie_secure', '1');
|
ini_set('session.cookie_secure', '1');
|
||||||
session_start ();
|
session_start ();
|
||||||
mb_internal_encoding ("UTF-8");
|
mb_internal_encoding ("UTF-8");
|
||||||
|
Loading…
Reference in New Issue
Block a user