2

i know maybe it's a repetitive question, but i would like to know if someone has a good idea for leave user session alive when using ajax calls.

I figured out that when i'm logged and i leave the browser open for 1-2 hours, when i launch ajax calls the session is expired.

i'm using the standard:

$config['sess_time_to_update']  = 7200;

i would like to know if someone has the definitive way to keep alive the user session, better without using interval js functions

5
  • 2
    sess_time_to_update is how many seconds until the session is regenerated. sess_expiration is the number of seconds the session will last. Setting sess_expirationto 0 will set the session to never expire. Commented Sep 22, 2011 at 19:47
  • oh sorry wrong line i was meaning expiration = 7200 ... so you suggest to put it to 0? i'm on CI 2.0+ version, does will session expire on browser call also if session expiration is setted to 0 (and expire on close = TRUE)? Commented Sep 22, 2011 at 21:34
  • 3
    7200 seconds = 2 hours, so this makes perfect sense. As birderic said, either disable the expiration by setting it to 0, or increase from the default number of seconds. Commented Sep 22, 2011 at 22:26
  • 1
    thanxs guys..My problem is solved reading your conversation..again thanxs. Commented Nov 7, 2012 at 9:18
  • Should you want to continue to have session expiration, please see agustinrc89 answer via stackoverflow.com/questions/7980193/…. Commented Feb 26, 2014 at 19:45

1 Answer 1

2

The session time is set in the __construct() so you could just call any method from the session library when you are making the ajax call and it should update your session expiration time. I would probably just set an "ajax_request" item in the session just to call the library and fire the constructor to reset the session expiration time.

Sign up to request clarification or add additional context in comments.

1 Comment

uhm but i need js ajax calls everytime for refrshing, if you read on top, user birderic has the right answer as i can see :P thx anyway i voted up ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.