Welcome Guest, Not a member yet? Register   Sign In
sess_expire_on_close
#1

Hello everyone...
I know, what in 3 version this param sess_expire_on_close was delete.
How remove session after close browser?
Okay. I know if set config sess_expiration = 0 session close ...

but if I make


PHP Code:
$this->config->set_item('sess_expiration'0);
$this->load->library('session'); 

not work, load only 

PHP Code:
$config['sess_expiration'] = 600; --> config.php 

[Image: f04ad9e6-9bb8-11e5-9c9a-9a6fe1dc486f.png]
config.php

[Image: 12f7d7c8-9bb9-11e5-927c-601b1f3264d2.png]

but when I show var_dump($this->config->item('sess_expiration')); I see = 0, but if I close browser and open again session live..., if I change sess_expiration = 0 in config.php file - session die after close browser.
Reply
#2

set_item is not permanent, it will reset.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

So set the value in the config file ...
Reply
#4

ok, but some time I need
[Image: -929206895.png]
how make?
Reply
#5

If I make sess_expiration = 0, all session destroy after close browser, but sometimes I need save session for somebody
Reply
#6

Write what you need to a different, separate cookie. Store whatever info you need on it.

When they come back to your index page (say) or login page, check for the existence or not of the non expiring cookie.

Hope that helps,

Paul.
Reply
#7

sess_expiration = 0 not working.

My config:

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

I need destroy session when user close window.
Reply
#8

(02-16-2016, 01:14 PM)jlamim Wrote: sess_expiration = 0 not working.

My config:

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

I need destroy session when user close window.

That's not how it works.

The event of a browser being closed is undetectable - you don't know if/when that happens and therefore it cannot trigger anything on the server side (meaning it can't effectively destroy the session). Instead, by setting a cookie's expiration time to 0, you tell the browser to only save the cookie in memory and thus not preserve it for the next time it runs. That way the user loses their session ID and cannot link to the same session.
However, the session data itself still exists on the server for some time, until the garbage collector runs and deletes all session files that have been inactive for more than ini_get('session.gc_maxlifetime') seconds.

Also, don't leave sess_save_path empty - you are required to configure that.
Reply
#9

Hello everyone...
I want to override or set config item dynamically. If user logged in without checking remember me checkbox then I want to set sess_expire_on_close value is false and user not checked then sess_expire_on_close value is true. I used the following php code: 

PHP Code:
if($this->input->post('remember')) 
$this->config->set_item('sess_expire_on_close''0');
else
$this->config->set_item('sess_expire_on_close''1'); 
but this process is not working. When I closed then browser without checking remember me dialog then session expire value is set to be 0 but still session is live. If a set config the following value 

PHP Code:
$config['sess_expire_on_close'] = TRUE; --> config.php 
then session will be destroy when closed browser but not store session value when I checked remember me checkbox. Idea
Reply
#10

(12-06-2015, 02:38 AM)Hello rolly... Wrote: I want to override or set config item dynamically. If user logged in without checking remember me checkbox then I want to set sess_expire_on_close value is false and user not checked then sess_expire_on_close value is true. I used the following php code: 

PHP Code:
if($this->input->post('remember')) 
$this->config->set_item('sess_expire_on_close''0');
else
$this->config->set_item('sess_expire_on_close''1'); 
but this process is not working. When I closed then browser without checking remember me dialog then session expire value is set to be 0 but still session is live. If a set config the following value 

PHP Code:
$config['sess_expire_on_close'] = TRUE; --> config.php 
then session will be destroy when closed browser but not store session value when I checked remember me checkbox.  Idea






rollyHello everyone...
I know, what in 3 version this param sess_expire_on_close was delete.
How remove session after close browser?
Okay. I know if set config sess_expiration = 0 session close ...

but if I make


PHP Code:
$this->config->set_item('sess_expiration'0);
$this->load->library('session'); 

not work, load only 

PHP Code:
$config['sess_expiration'] = 600; --> config.php 

[Image: f04ad9e6-9bb8-11e5-9c9a-9a6fe1dc486f.png]
config.php

[Image: 12f7d7c8-9bb9-11e5-927c-601b1f3264d2.png]

but when I show var_dump($this->config->item('sess_expiration')); I see = 0, but if I close browser and open again session live..., if I change sess_expiration = 0 in config.php file - session die after close browser.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB