• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI session expires rapidly

#6
[eluser]aidehua[/eluser]
I think there are good reasons for the session id being regenerated regularly. Derek Allard explains it a bit here, and refers you to this Wikipedia article.

So in general, latching onto the session id as a form of long-term persistent identification is probably not the best way to go.

You could generate your own random number, though, and store it in the session user_data. That would persist for your full 7200 seconds, and then you could leave

Code:
$config['sess_time_to_update'] = 300;

in place for security.

Here's one way to do it (there may be others / better):

Code:
//Create a unique random token
$this->load->helper('string');
$token = random_string('unique') . random_string('unique');

//Add token to session user_data
$session_data = array( 'token' => $token );
$this->session->set_userdata($session_data);

//Then when you want to read the session user_data
$token = $this->session->userdata('token');


Messages In This Thread
CI session expires rapidly - by El Forum - 01-09-2010, 03:01 PM
CI session expires rapidly - by El Forum - 01-09-2010, 03:19 PM
CI session expires rapidly - by El Forum - 01-09-2010, 03:23 PM
CI session expires rapidly - by El Forum - 01-09-2010, 03:58 PM
CI session expires rapidly - by El Forum - 01-09-2010, 04:36 PM
CI session expires rapidly - by El Forum - 01-10-2010, 03:16 AM
CI session expires rapidly - by El Forum - 03-01-2010, 06:51 AM
CI session expires rapidly - by El Forum - 03-01-2010, 09:18 AM
CI session expires rapidly - by El Forum - 03-02-2010, 05:20 AM
CI session expires rapidly - by El Forum - 03-04-2010, 08:48 AM
CI session expires rapidly - by El Forum - 03-15-2010, 01:46 AM
CI session expires rapidly - by El Forum - 03-15-2010, 03:09 AM
CI session expires rapidly - by El Forum - 03-15-2010, 03:17 AM
CI session expires rapidly - by El Forum - 03-15-2010, 03:29 AM
CI session expires rapidly - by El Forum - 03-15-2010, 03:39 AM
CI session expires rapidly - by El Forum - 03-15-2010, 03:44 AM
CI session expires rapidly - by El Forum - 03-16-2010, 04:26 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.