Natasha
Natasha

Reputation: 980

Issue with session timeout

When a user logged in, after some time the session times out and redirects to the home page.

Does anyone know why this may be occurring?

Following code is used for logout:

if($user->isLogged())
{
    $user->logout();
    $session->set('error','Successfully Logged Out');
    $response->redirect('index.php');
}

function logout() {     
     $this->session->delete('user_id');
     $this->data = array();
}

function isLogged() {
    return !empty($this->data);
}

Is there any way for increasing session time?

Upvotes: 2

Views: 154

Answers (1)

Sachin Kumaram
Sachin Kumaram

Reputation: 920

ini_set('session.gc_maxlifetime', '28800'); 

Upvotes: 1

Related Questions