[eluser]korpirkor[/eluser]
Hi
I'm doing my first project on CodeIgniter (and first with MVC at all) and I have question about Session library.
There is
sess_update() method, which is updating last_activity and session_id after $config['sess_time_to_update'] seconds.
My question is: why are we creating new session_id each time ???
I have rewritten sess_update into MY_Session:
Code:
class MY_Session extends CI_Session
{
function sess_update()
{
if (($this->userdata['last_activity'] + $this->sess_time_to_update) >= $this->now)
return;
$this->userdata['last_activity'] = $this->now;
$cookie_data = NULL;
if ($this->sess_use_database === TRUE)
{
$cookie_data = array();
foreach (array('session_id','ip_address','user_agent','last_activity') as $val)
$cookie_data[$val] = $this->userdata[$val];
$this->CI->db->query($this->CI->db->update_string($this->sess_table_name, array('last_activity' => $this->now), array('session_id' => $this->userdata['session_id'] )));
}
$this->_set_cookie($cookie_data);
}
}
Question 2. Can my code mess up something?