Welcome Guest, Not a member yet? Register   Sign In
CI Sessions

I am struggling with some Session issues and I think I have attributed it to Chrome but I am not totally sure. Anyone had any problems with CI setting a cookie in Chrome for the CI Sessions? I am using a database. What is seems the problem is, when the session is first made it never saves the cookie then when the user navigate to a new page no cookie is set so it creates a new entry in the database. However that second time, it creates 2 entries in the database, then one, then 2...

Any thoughts? Should I just use regular PHP sessions?

CI uses "regular php sessions", so I can't see how that would make a difference. When you say you've attributed it to Chrome, that means you've tested it in IE and Firefox where it works normally? You do realize that sessions and cookies are completely different things, right?

Noctrum thanks for the suggestions but I am not quite sure that you understand that sessions and cookies in the CI environment work with each other and if my memory serves me correctly php's native sessions also use cookies to validate the users client with their session on the server.

For more explanation go to http://ellislab.com/codeigniter/user-gui...sions.html and read the red box at the top. If you don't have time for that it says:

Quote:Note: The Session class does not utilize native PHP sessions. It generates its own session data, offering more flexibility for developers.

Then look a little lower and read:

Quote:When a page is loaded, the session class will check to see if valid session data exists in the user's session cookie.

I make the attribution to it being Chrome due to other posts I have read, but I have not made huge efforts to test in ALL environments.

Any other suggestions anyone?

Any ideas about this before it get's lost in the shuffle? Is there a problem setting CI sessions within chrome?

I am using CI sessions with the database for a project I have been testing. I have had no issues using chrome. FYI.

Ok I did some more research on this and this is what I have come up with.

No matter which browser I use (testing in FF and Chrome) i get these results:

1. Session class finds no cookie
2. Session class succesfully creates a cookie (at least CI, basing it on the logs, thinks it creates the cookie)
3. When I try and use the cookie when it gets to the actual displaying of the page it return bool (false)
--I did this by using the cookie helper and typed var_dump(get_cookie('cookiename'));

Any ideas now...

I know I keep pulling this out of the grave but I am still looking for a solution.

I think no one has answered because what you are experiencing is not common. Just some basic questions:

1. Have you tried deploying to another server in case this has something to do with your development environment?

2. Have you tried replacing your system (core) files with the latest copy of CI?

3. Are you extending the session class?

I will try those today and let you know...

Theme © iAndrew 2016 - Forum software by © MyBB