Welcome Guest, Not a member yet? Register   Sign In
losing session data
#9

[eluser]Narkboy[/eluser]
[quote author="St0neyx" date="1290784916"]
Now could you explain the last line of sess_write() to me? seems like it's writing an cookie...

So therefor i say, it still writes cookies..[/quote]

Yes. The cookie stores the session ID. Without a copy of the session ID, the client cannot confim it's identity to the server.

Basically - the server reads the session cookie from the client, queries the database for a matching session record, and loads the content. From there, the developer can access that through $this->session->foo.

Since CI updates the session ID on a frequent basis, the cookie needs to be rewritten to contain the current ID. If we didn't re-write the cookie, then the browser would have an older version of the session ID and not be able to identify itself.

Crucually, session 'userdata' IS stored in the db and does not have a 4k limit. You can test definitevly by writing 5k+ of random text to see if it holds.

At least - that's hwat I get from the code you posted. Can't say I've ever tried to drop more than 4k into session data before though.

/B

Edit:

Also, checkout the last comment lines in the code:
Code:
// Write the cookie.  Notice that we manually pass the cookie data array to the
    // _set_cookie() function. Normally that function will store $this->userdata, but
    // in this case that array contains custom data, which we do not want in the cookie.

Smile


Messages In This Thread
losing session data - by El Forum - 11-25-2010, 07:40 AM
losing session data - by El Forum - 11-25-2010, 08:42 AM
losing session data - by El Forum - 11-25-2010, 08:51 AM
losing session data - by El Forum - 11-25-2010, 10:31 AM
losing session data - by El Forum - 11-25-2010, 02:04 PM
losing session data - by El Forum - 11-26-2010, 02:09 AM
losing session data - by El Forum - 11-26-2010, 03:08 AM
losing session data - by El Forum - 11-26-2010, 03:21 AM
losing session data - by El Forum - 11-26-2010, 04:01 AM
losing session data - by El Forum - 11-26-2010, 05:28 AM
losing session data - by El Forum - 11-26-2010, 06:21 AM
losing session data - by El Forum - 11-26-2010, 06:45 AM
losing session data - by El Forum - 11-26-2010, 06:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB