Welcome Guest, Not a member yet? Register   Sign In
Session handling
#12

[eluser]Nick Jennings[/eluser]
Hello, thanks for your reply.

Just wondering why the documentation would say the following, if the custom userdata was only kept in the database (and not also in the cookie).

Note: Cookies can only hold 4KB of data, so be careful not to exceed the capacity. The encryption process in particular produces a longer data string than the original so keep careful track of how much data you are storing.

Thanks,
Nick

[quote author="simshaun" date="1230677864"]After investigating this, here is what I found.

When you have CI storing sessions in the database:
A cookie is placed on the client's computer containing:
- session_id (PHP only stores this)
- ip_address
- user_agent
- last_activity

When loading a page that uses sessions:

CI Sessions:
CI grabs the session_id from the cookie and looks for a corresponding row in the database.
CI performs the security checks based on ip, user_agent, and last_activity.
If security check passes, session data is retrieved when you call it.

PHP Sessions: (assuming you also store them in the database)
PHP grabs the session_id from the cookie and looks for a corresponding row in the database.
If found, session data is retrieved when you call it.

Conclusion:
CI does NOT store your session data in the cookie, so long as you have set CI to store sessions in the database.[/quote]


Messages In This Thread
Session handling - by El Forum - 12-09-2008, 06:03 AM
Session handling - by El Forum - 12-09-2008, 08:34 AM
Session handling - by El Forum - 12-09-2008, 04:08 PM
Session handling - by El Forum - 12-09-2008, 04:22 PM
Session handling - by El Forum - 12-09-2008, 05:42 PM
Session handling - by El Forum - 12-09-2008, 06:43 PM
Session handling - by El Forum - 12-09-2008, 09:12 PM
Session handling - by El Forum - 12-09-2008, 10:04 PM
Session handling - by El Forum - 12-09-2008, 10:30 PM
Session handling - by El Forum - 12-30-2008, 10:11 AM
Session handling - by El Forum - 12-30-2008, 10:57 AM
Session handling - by El Forum - 12-30-2008, 11:11 AM
Session handling - by El Forum - 12-30-2008, 11:14 AM
Session handling - by El Forum - 12-30-2008, 11:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB