EllisLab text mark
Advanced Search
     
Session keeps “breaking” on me.
Posted: 04 October 2012 04:28 PM   [ Ignore ]
Joined: 2011-05-09
3 posts

So, my current task involves a site where people can sign in, and view a series of training videos on a particular topic.  The only trouble is that once I have them log in, and I create a session, that session seems to mysteriously disappear after a few minutes.  This is the block of code in my config.php page:

$config['sess_cookie_name''cc_session';
$config['sess_expiration'0;
$config['sess_expire_on_close'FALSE;
$config['sess_encrypt_cookie'FALSE;
$config['sess_use_database'TRUE;
$config['sess_table_name''cc_sessions';
$config['sess_match_ip'TRUE;
$config['sess_match_useragent'TRUE;
$config['sess_time_to_update'3000000

Why is sess_time_to_update set so high?  At first, I thought that was the culprit, updating the session after 5 minutes.  I have set the session to record to a database, and all that good stuff.  Please, ask me questions, and help me get to the bottom of this!  Thank you!

 
Posted: 04 October 2012 05:23 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2011-05-09
3 posts

I will add that I am NOT running AJAX on this page.  In my viewer I have this code to create an iFrame that will “ping back” the server every minute.  This is a quick and dirty stop gap measure to let the server know that this person is currently viewing the course, and has viewed the course for _____ minutes. The name of the site is removed for obvious reasons!

<iframe id="timerAddEnd" src="http://____._____.org/course/finish/<?=$course->intKey?>/ping" ></iframe

Script tag removed here

var auto_refresh setInterval(
  function () 
{
   
var iframe document.getElementById('timerAddEnd');
   
iframe.src iframe.src;
  
}60000); // refresh every minute 

Script tag removed here

 
Posted: 09 October 2012 01:37 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-05
241 posts

A few things to try:

Change cookie name to ‘ccsession’; - you should not have a “_” in a cookie name, causes issues

$config[‘sess_match_ip’] = TRUE;  <- try setting this to false - you might have a cycling IP


$config[‘sess_match_useragent’] = TRUE;  <- try setting this to false