• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Any way to force sessions to *not* update on certain AJAX requests?

#1
Hi all,

I'm a fairly experienced CI dev but I'm having trouble finding a good solution for this.

Essentially, I'm trying to implement "idle logout" (session expiration) detection. I'd like to be able to periodically make an AJAX call to check if the current session entry still contains credentials but by making these AJAX calls, the session is updated automatically to extend its validity (indefinitely!).

Has anyone found a way to do this?

Cheers!
Reply

#2
Did you read and try this?

CodeIgniter Users Guide - Session Library - A note about concurrency
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
Thanks InsiteFX, but I don't think that's quite the problem. Unless I'm misunderstanding? It's not that AJAX requests are blocking/interfering, it's that I'd like to skip the auto-update of sessions on specific AJAX requests.

Please feel free to correct me if I've missed the point you were making.
Reply

#4
The only other thing that CI has for Ajax is this:

is_ajax_request()

You may need to extend the library to suit your needs.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#5
Sadly I think you're right. I was hoping for a less arduous solution but I guess extending the Session Library is the only option.

Cheers anyway!
Reply

#6
@InsiteFX ...

You're doing it yet again.
You see "Session" and just paste the link to something else mentioning "session".
This doesn't help.

@twistedpixel

You can put a counter in sync with the session cookie.
Reply

#7
(01-03-2017, 06:51 AM)Narf Wrote: @InsiteFX ...

You're doing it yet again.
You see "Session" and just paste the link to something else mentioning "session".
This doesn't help.

@twistedpixel

You can put a counter in sync with the session cookie.

Sorry, for some reason I didn't get a notification of a reply here. Actually Narf, that's exactly what I ended up doing (as the second half of the issue you gave me advice on earlier). Works beautifully.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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