note 71760 added to function.setcookie
| From: | core58 at mail dot ru | Date: | Thu, 14 Dec 2006 16:35:51 +0000 |
| Subject: | note 71760 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120610@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 66.163.161.117
Probable Submitter: 213.184.229.145
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- https://master.php.net/note/edit/71760
Del: integrated -- https://master.php.net/note/delete/71760/integrated
Del: useless -- https://master.php.net/note/delete/71760/useless
Del: bad code -- https://master.php.net/note/delete/71760/bad+code
Del: spam -- https://master.php.net/note/delete/71760/spam
Del: non-english -- https://master.php.net/note/delete/71760/non-english
Del: in docs -- https://master.php.net/note/delete/71760/in+docs
Del: other reasons-- https://master.php.net/note/delete/71760
Reject -- https://master.php.net/note/reject/71760
Search -- https://master.php.net/manage/user-notes.php