Welcome Guest, Not a member yet? Register   Sign In
CI' session question
#7

[eluser]chmod[/eluser]
Thanks to iainco. you are right.although I saved the session_id before,but he session updated, and CI's method gc deleted it.so I can't acess it.so, I resolved this problem:
Edit the config.php:
Step 1:
Code:
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 300;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = TRUE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 300;

Step 2:
decide gc:
$config['sess_probability'] = 25;


Step 3:
edit lib's Session.php
change:
Code:
if ((rand() % 100) < $this->gc_probability)

to

Code:
if ((rand() % $this->CI->config->item('sess_probability')) < $this->gc_probability)


Step 4:
change:
Code:
setcookie(
                    $this->sess_cookie_name,
                    $cookie_data,
                                        $this->sess_expiration + time(),
                    $this->cookie_path,
                    $this->cookie_domain,
                    0
                );
to
Code:
setcookie(
                    $this->sess_cookie_name,
                    $cookie_data,
                    0,
                    //$this->sess_expiration + time(),
                    $this->cookie_path,
                    $this->cookie_domain,
                    0
                );

all these code resolved three things:
1:when I close browser's windows,the cookie will be delete.
2:CI's gc will work by myself;
3Confusedession will not regen in short time.


Messages In This Thread
CI' session question - by El Forum - 11-29-2008, 09:45 AM
CI' session question - by El Forum - 11-29-2008, 10:54 AM
CI' session question - by El Forum - 11-29-2008, 11:31 AM
CI' session question - by El Forum - 11-29-2008, 11:47 AM
CI' session question - by El Forum - 11-29-2008, 11:02 PM
CI' session question - by El Forum - 12-01-2008, 06:53 AM
CI' session question - by El Forum - 12-01-2008, 10:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB