note 94297 added to features.cookies
| From: | john at host89 dot net | Date: | Wed, 28 Oct 2009 01:24:53 +0000 |
| Subject: | note 94297 added to features.cookies | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-162166@lists.php.net to get a copy of this message | ||
I'm currently developing a secure system utilizing PHP session cookies, and rather than trying
to deal with recreating a session every time the script runs (which would hurt server performance),
I'm having the script send a 2nd cookie to the client which contains an MD5 of their username
along with a random value (so that it's harder to generate a matching key if somebody is trying
to hijack the session.) The original random value can be stored as $_SESSION['rndvalue']
or something of the like, and easily re-hashed and compared to the cookie. If it isn't valid,
just a simple session_destroy(); does the trick. For higher security, the random value could even be
changed at every new page, and to make leeway for that double-click phenomon, save the old one as
'rndvalueold' with the expiration time as 'rndvalueexpire' or something. This
will also let users use the back button even if the session ID is passed via GET or POST.
----
Server IP: 64.71.164.2
Probable Submitter: 98.135.47.134
----
Manual Page -- http://www.php.net/manual/en/features.cookies.php
Edit -- https://master.php.net/note/edit/94297
Del: integrated -- https://master.php.net/note/delete/94297/integrated
Del: useless -- https://master.php.net/note/delete/94297/useless
Del: bad code -- https://master.php.net/note/delete/94297/bad+code
Del: spam -- https://master.php.net/note/delete/94297/spam
Del: non-english -- https://master.php.net/note/delete/94297/non-english
Del: in docs -- https://master.php.net/note/delete/94297/in+docs
Del: other reasons-- https://master.php.net/note/delete/94297
Reject -- https://master.php.net/note/reject/94297
Search -- https://master.php.net/manage/user-notes.php