[development] Sessions and non-logged-in users

John VanDyk jvandyk at iastate.edu
Tue May 16 22:04:53 UTC 2006


>* and then Khalid B declared....
>>  Use session data.
>>
>>  To store something use:
>>
>>  $_SESSION['foo'] = $bar;
>>
>>  To get it back use:
>>
>>  $baz = $_SESSION['foo'];
>>
>>  That is it.
>
>Thanks.
>
>Will the data not be lost when the browser is closed?
>

The browser has a cookie with an ID that corresponds to a row in the 
sessions table, which is where $bar is stored.

If the user has the browser set to erase cookies when the browser 
closes, then the answer to your question is yes, because Drupal 
cannot associate the row without the ID stored in the cookie. Else no.


More information about the development mailing list