There is now a config value for the session management to not use the database

This commit is contained in:
Michael Vogel 2015-12-22 22:11:08 +01:00
parent 307beb47fd
commit 61956e1098

View file

@ -5,8 +5,11 @@ require_once('include/security.php');
require_once('include/datetime.php');
function nuke_session() {
session_unset();
/*
if (get_config('system', 'disable_database_session')) {
session_unset();
return;
}
new_cookie(0); // make sure cookie is deleted on browser close, as a security measure
unset($_SESSION['authenticated']);
@ -22,7 +25,7 @@ function nuke_session() {
unset($_SESSION['my_address']);
unset($_SESSION['addr']);
unset($_SESSION['return_url']);
*/
}
@ -206,14 +209,13 @@ else {
}
function new_cookie($time) {
$a = get_app();
if (get_config('system', 'disable_database_session'))
$old_sid = session_id();
$old_sid = session_id();
session_set_cookie_params($time);
//session_set_cookie_params($time, "/", $a->get_hostname());
session_regenerate_id(false);
q("UPDATE session SET sid = '%s' WHERE sid = '%s'", dbesc(session_id()), dbesc($old_sid));
logger("Session parameter lifetime: ".$time." - got: ".print_r(session_get_cookie_params(), true), LOGGER_DEBUG);
if (get_config('system', 'disable_database_session')) {
session_regenerate_id(false);
q("UPDATE session SET sid = '%s' WHERE sid = '%s'", dbesc(session_id()), dbesc($old_sid));
}
}