note 71760 deleted from function.setcookie by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 17:55:11 +0000 |
| Subject: | note 71760 deleted from function.setcookie by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155039@lists.php.net to get a copy of this message | ||
Note Submitter: core58 at mail dot ru
----
Regarding to "rajneshavon@gmail dot com" note:
There only one type of cookies, simply -- cookie is the data storage itself, without any
types/categories.
Cookies have some parameters (expiration date, domain, path) which should be considered.
Sessions mechanism works kinda simply:
when You call "session_start();" -- server attaches header
Set_cookie: session_name()=session_id(); path=/
usually. This cookie can be used in the next browser request to distinct one user from another
(suggesting that session_id() has unique value for every user -- is't usually 32 md-hash).
To be completely simple -- server just tries to open file at session storage with the name like
sess_<session_id()>. If that file exists -- server reads the data and performs unserialize()
and that gives You opportunity to get the stored data as $_SESSION array -- this array is being
simply serialized/unserialized when operating with it in scripts.
If browser disables cookies -- You can set
session.use_trans_sid = 1
That will tell Your PHP parser to append ?session_name()=session_id() to every link being outputted
at the page and also add hidden field with that name=value at forms if any.
Upon clicking such link with session in the query string, You will receive session_id but from $_GET
array. That will tell server where to get session data, just without cookies.
The only minus is that Your links will become "variable" with that boring session hash.