Sess_expire_on_close does not work

I have a problem .. in $config['sess_expire_on_close'] = TRUE; when I close the browser ... the session is still stored in the database. and I still see the data in the column user_data.

config.php

  $config['sess_cookie_name']     = 'ci_session';
  $config['sess_expiration']        = 2400;
   $config['sess_expire_on_close']  = TRUE;
  $config['sess_encrypt_cookie']    = FALSE;
  $config['sess_use_database']  = TRUE;
  $config['sess_table_name']    = 'ci_sessions';
  $config['sess_match_ip']  = FALSE;
  $config['sess_match_useragent']   = TRUE;
 $config['sess_time_to_update'] = 300;

Need help .. the goal is to show all online users.

I am using CI version 2.1.3

+4
source share
3 answers

The server never knows about closing the browser. 'sess_expire_on_close' considers whether the user's cookie will be recorded and reused when the browser restarts.

In order to detect and end a session, you need to perform the verification described in this question: javascript detect browser close tab / close browser

$this->session->sess_destroy();

codeigniter.

+3

. cookie 0, , cookie, ( ). , , " " , , , .

, , .

+1

TRY to configure the application /config/config.php

$ config ['sess_expiration'] = 0;
$ config ['sess_expire_on_close'] = TRUE;

THIS should be OK

-1
source

All Articles