Code này bị expire toàn bộ kể cả không idle
Thay bằng code dưới đây sửa hàm init() trong /includes/http/Session.php
static function init($sessionid = false) {
if(empty($sessionid)) {
HTTP_Session2::start(null, null);
$sessionid = HTTP_Session2::id();
HTTP_Session2::setExpire(time() + 8 * 60 * 60); // expires in one hour
HTTP_Session2::setIdle(60 * 60); // idles in 60 minutes
} else {
HTTP_Session2::start(null, $sessionid);
}
if (HTTP_Session2::isExpired()) {
// expired
// echo('Your session is expired!');
HTTP_Session2::destroy();
}
if (HTTP_Session2::isIdle()) {
// idle
// echo("You've been idle for too long!");
HTTP_Session2::destroy();
}
HTTP_Session2::updateIdle();
HiepNH -
Code này bị expire toàn bộ kể cả không idle
Thay bằng code dưới đây sửa hàm init() trong /includes/http/Session.php
static function init($sessionid = false) {
if(empty($sessionid)) {
HTTP_Session2::start(null, null);
$sessionid = HTTP_Session2::id();
HTTP_Session2::setExpire(time() + 8 * 60 * 60); // expires in one hour
HTTP_Session2::setIdle(60 * 60); // idles in 60 minutes
} else {
HTTP_Session2::start(null, $sessionid);
}
if (HTTP_Session2::isExpired()) {
// expired
// echo('Your session is expired!');
HTTP_Session2::destroy();
}
if (HTTP_Session2::isIdle()) {
// idle
// echo("You've been idle for too long!");
HTTP_Session2::destroy();
}
HTTP_Session2::updateIdle();
if(HTTP_Session2::isIdle() || HTTP_Session2::isExpired()) {
return false;
}
return $sessionid;
}