AJAX and CI Session (v1.7) w/DB |
[eluser]wallysson[/eluser]
well, i haven't the second page, so i reconstruct my method, before i change my class, i sent for the model severy ajax request wich haves diferent ids, now i send one ajax request with an array, and in the model i make an loop wich retrieves each id. Well, i spent 2 hours or more fixing my methods, but it could be an way...
[eluser]wallysson[/eluser]
For anyone who get the same problem, and maybe can't just don't update ajax calls, just follow this link and everything will work, you will lose a litlle of security, but for me it will be ok. The security problem it's because your session_id will never get updated... better than don't update nothing... Was my problem because i'm using Extjs framework at frontend, and in this system you don't have any refresh on the browser, everything are made with ajax calls... Luck 4 everyone, and God bless you!
[eluser]wallysson[/eluser]
I did fill changes on the else state: Code: else {
[eluser]Kobus M[/eluser]
Hi guys, I have tried EVERY solution mentioned so far. I have spent days on this sofar. I keep getting random session expiration when having Ajax requests. Here is some of what I tried. 1. Replaced Session.php: http://stackoverflow.com/questions/15829...ng-on-webp 2. Tried all variants of this fix that I could find: https://degreesofzero.com/article/fixing...niter.html 3. Everything in this thread: http://ellislab.com/forums/viewthread/102456 4. I tried this: http://www.hiretheworld.com/blog/tech-bl...conditions 5. This: https://github.com/EllisLab/CodeIgniter/pull/1283 6. And this: https://github.com/EllisLab/CodeIgniter/pull/1900 7. Also: http://upshots.org/codeigniter/codeignit...on-bug-fix I am really at a loss - it is making me grey before my age... :-( Anybody else with something I can try? Kind regards, Kobus
[eluser]InsiteFX[/eluser]
You can try this is works for me. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]Karman de Lange[/eluser]
The only semi reliable method that works for me is as per insiteFX but also adding: in config.php Code: $config['sess_time_to_update'] = $config['sess_expiration']; And if still issues set async to false on all ajax or simply set global to false. Code: $.ajaxSetup({ I now only get kicked out every few days.. not every 5 minutes
[eluser]jonez[/eluser]
If it's an option upgrade to CI3 and using the native session driver. It doesn't have this problem with AJAX calls. Like you I pulled my hair out for a while on this one. Almost swapped away from CI because of it. Every fix I found lowered security in other respects. Then a wild CI3 appeared and it was super effective. Code: $.ajaxSetup({
[eluser]Karman de Lange[/eluser]
[quote author="jonez" date="1393011316"]If it's an option upgrade to CI3 and using the native session driver. It doesn't have this problem with AJAX calls. Like you I pulled my hair out for a while on this one. Almost swapped away from CI because of it. Every fix I found lowered security in other respects. Then a wild CI3 appeared and it was super effective. Code: $.ajaxSetup({ Yup, bad idea... but better than users shouting at you every 5 minutes cause they have to login again ;-) Will checkout CI 3 on next project
[eluser]jonez[/eluser]
[quote author="Karman de Lange" date="1393175179"]Yup, bad idea... but better than users shouting at you every 5 minutes cause they have to login again ;-)[/quote] If a timeout occurs the browser will lock for a solid 5+ seconds. It may not seem that bad when the server responds quickly but any time it doesn't you will see why this isn't a proper solution. |
Welcome Guest, Not a member yet? Register Sign In |