Welcome Guest, Not a member yet? Register   Sign In
suppressing session cookies (and sessions) for anonymous users
#5

[eluser]Mirage[/eluser]
Yoda -

Perhaps you just need to rethink your approach a little. There's more than one way to solve this problem.

First of all - COOKIE does not equal SESSION. In other words you can set plenty of cookies in the browser without hooking them to the server side session. It appears to me that you are autoloading the session - which is what creates the cookie automagically and thus your dilemma.

As the previous poster asked, it's relevant which Session Library you use. CI's native Session Library only uses a Cookie anyway, which makes it extremely scaleable [although limited in storage]. If you are using a server side session (file or database), then we're talking a little something different. Let's go forward assuming that you are using server side storage for your session, which you'd like to avoid invoking when guests visit the public site.

If your site/application is truly this separated you should perhaps cache all output and only avoid this when protected pages are visited. This should be easy enough to distinguish in your controllers. So in your protected areas you load the session in the controller constructor or a post-constructor hook. Further you can override the CI cache for all your protected pages using a hook.

A question I have is - why would you want to differentiate whether or a logged in member or guest is browsing your 'public' page. Shouldn't those be cacheable for all visitors?


Messages In This Thread
suppressing session cookies (and sessions) for anonymous users - by El Forum - 07-31-2008, 08:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB