note 69139 deleted from ref.session by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 17:11:10 +0000 |
| Subject: | note 69139 deleted from ref.session by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142205@lists.php.net to get a copy of this message | ||
Note Submitter: in dot tray at NOSPAM dot tiscali dot co dot uk
----
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...