note 69139 added to ref.session
| From: | in dot tray at NOSPAM dot tiscali dot co dot uk | Date: | Thu, 24 Aug 2006 13:19:51 +0000 |
| Subject: | note 69139 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116263@lists.php.net to get a copy of this message | ||
Some users turn off cookies on their browser. It would be nice to advise such users that they need
to switch on cookies to use your web site, especially if you do not allow URL session IDs.
The first request to your site will not contain cookie data from the user. Some developers do a
little trick on the server at this point to redirect the user to the same or different page and in
so doing endeavour to deliver a cookie so that it can then be determined if this was successful on
the second request. It has the advantage of letting the no-cookie user know at the on-set if there
is a problem. Of course this adds an overhead of time and server resources. It also might impare
your site's position with popular search engines.
So, since many sites will work to a point without sessions working (i.e. scatterings of static links
and basic searches), I allow the user to load the first page and then perform the cookie check upon
the user's subsequent request. If the cookie canot be found I place advice text accordingly
simple (unchecked) solution...
function cookie_check() {
if (!isset($_COOKIE['PHPSESSID'])) {
return false;
} else {
return true;
}
if (!cookie_check()) {
echo "This site uses cookies, dah dah dah...";
}
I have looked fairly extensively for information on this issue but there isn't a great deal
about. So, if anyone out there has more experience of this...
----
Server IP: 83.138.144.80
Probable Submitter: 195.166.97.42 (proxied: 1.1 PLHPROX101)
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/ref.session.php
Edit -- https://master.php.net/note/edit/69139
Del: integrated -- https://master.php.net/note/delete/69139/integrated
Del: useless -- https://master.php.net/note/delete/69139/useless
Del: bad code -- https://master.php.net/note/delete/69139/bad+code
Del: spam -- https://master.php.net/note/delete/69139/spam
Del: non-english -- https://master.php.net/note/delete/69139/non-english
Del: in docs -- https://master.php.net/note/delete/69139/in+docs
Del: other reasons-- https://master.php.net/note/delete/69139
Reject -- https://master.php.net/note/reject/69139
Search -- https://master.php.net/manage/user-notes.php