CodeIgniter Forums
config session data for Ajax - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: config session data for Ajax (/showthread.php?tid=35614)

Pages: 1 2


config session data for Ajax - El Forum - 11-04-2010

[eluser]Ngulo[/eluser]
hi all ,

is there someone can tells me which configruation is using correctly for session using Ajax requests?

mine are as shown:

Code:
$config['sess_cookie_name']        = '*******';
$config['sess_expiration']        = 0;
$config['sess_encrypt_cookie']    = TRUE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = '********';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = FALSE;
$config['sess_time_to_update']     = 30;

now ajax works good on my site but after n time sessions losts ....is there a perfect configuration can i use? Smile)

thanks


config session data for Ajax - El Forum - 11-04-2010

[eluser]WanWizard[/eluser]
This config rotates the session ID every 30 seconds. If this happens on an ajax call, the next request finds an invalid session.

Search for sess_update and IS_AJAX to find the solution to this known issue.


config session data for Ajax - El Forum - 11-04-2010

[eluser]Ngulo[/eluser]
thanks wanwizard i've search into forum but my english is very very bad Sad

so i'm hoping someone can give me directly a good configuration using not session database for my ajax site Smile

hoping yet Smile))


config session data for Ajax - El Forum - 11-04-2010

[eluser]WanWizard[/eluser]
See http://ellislab.com/forums/viewreply/820052/


config session data for Ajax - El Forum - 11-05-2010

[eluser]Ngulo[/eluser]
sorry wan i've read but i can't understand very well englihs Sad((

i see just some bite of code but i really can not understand Sad(

does it means that if request is ajax request,i have to update session by $this->session->sess_update()?


thanks and sorry me but it's really hard for me understand english and with translator i can't read very well in my own language. Sad(


config session data for Ajax - El Forum - 11-05-2010

[eluser]WanWizard[/eluser]
No, it means you have to create a MY_Session.php file in application/libraries (see the manual on extending core libraries), and copy that code in it.

It will extend the session library, and will make sure the session_id isn't updated on ajax calls. It also fixed a problem with the destroy method (which is not related to your question).


config session data for Ajax - El Forum - 11-05-2010

[eluser]InsiteFX[/eluser]
I have updated the code in the link! I forgot the define in constants.php
Also the ajax check was wrong. corrected all code.

InsiteFX


config session data for Ajax - El Forum - 11-06-2010

[eluser]Ngulo[/eluser]
thanks men but my question now is another Tongue

cause i'm not using ci session native librariy but i'm using instead this library i've found
http://www.philsbury.co.uk/index.php/blog/code-igniter-sessions/

must i use my_session library also with this library which uses native php session?

really thankss


config session data for Ajax - El Forum - 11-06-2010

[eluser]InsiteFX[/eluser]
You can still add the code, just add the code to the correct method's!

Also the library you are using is limited to 4kb cookies, no database.

InsiteFX


config session data for Ajax - El Forum - 11-06-2010

[eluser]Ngulo[/eluser]
ok i put all define and library on my application.

but one last question is need i to load that on autoload.php config file?

or just load that only into ajax functions?

thankss Smile)