views:

65

answers:

1

I'm setting a Session variable with an ajax call. I've tried both by using the helper and by using the straight PHP $_SESSION syntax. For some reason, whenever I reload the page, all SESSION data is gone.

What is annoying about this, is that it happens sporadically. I thought at first, it had to do with the browser I was using, but it does not. I have tried changing all the Session settings in core.php and no combination seems to be reliable.

Any thoughts as to how I can fix this problem?

+1  A: 

You'll want to open the app/config/core.php file and modify the Security.level section. From the manual:

Security.level

The level of CakePHP security. The session timeout time defined in 'Session.timeout' is multiplied according to the settings here.

Valid values: 'high' = x 10 'medium' = x 100 'low' = x 300

'high' and 'medium' also enable session.referer_check

CakePHP session IDs are also regenerated between requests if 'Security.level' is set to 'high'.

Search the core.php file for Security.level and change the setting to low and ensure you Session.timeout value is high enough. You may have to play with both of these settings until your satisfied.

webbiedave
Yeah, I've done all these things. What seems to get the session working is when i use a combination of session_destroy(); and unset($_SESSION); Once I do this once and reload, my session starts working... However, this is less than ideal
Nick