Welcome Guest, Not a member yet? Register   Sign In
Session getting destroyed
#1

[eluser]joe.afusco[/eluser]
So, I'm curious if someone else has run into this. I've got 3 controllers, and one controller uses a query string, which I had to enable in the config. Whenever I refresh my other two controllers (ones that don't use query strings), the session variables are fine, and stay the same, as expected. However, when I load the page that uses a query string, it creates a new session for the user. I was previously POSTing to the controller, and there was no issue with the session variables. It was only when I switched to using a query string on this controller that this starting occuring. It also only happens after more than one load on that controller. First time the controller is run, it keeps the current session, no problems.

Any reason why it would do this? The only part of the code that I've altered (outside of the config) is accessing the variable via $_POST, to :

parse_str($_SERVER['REQUEST_URI'], $_GET);

Pretty frustrating that the session keeps dropping
#2

[eluser]bretticus[/eluser]
Using parse_str to extract a $_GET variable from the URI shouldn't affect sessions in anyway that I can think of. Typically, sessions are affected by a useragent change (like toggling firebug on and off will destroy your CI session because the user agent changes.)

I've also noticed issues with AJAX destroying the session. If you google "CodeIgniter session AJAX" (or perhaps a better search query) you will find solutions for that problem.

However, I can't help wondering, you probably don't need to change anything in the config file for your method of getting $_GET because you are faking it Smile (it's not the real $_GET super global.) So unless it's changing the URI settings:

http://ellislab.com/codeigniter/user-gui...oting.html

I think you might try reversing the setting to use GET in the config (just in case.)

Can you...

1. Post your session settings from config.php here?
2. Try disabling whatever you enabled for GET in config.php (unless I'm wrong and you really do need it.)
3. Explain if you are using something that might change your user agent string or AJAX.




Theme © iAndrew 2016 - Forum software by © MyBB