Re: Yet another cookie question
| From: | (Richard Lynch) | Date: | Fri, 16 Jun 2000 00:00:17 +0000 |
| Subject: | Re: Yet another cookie question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2010@lists.php.net to get a copy of this message | ||
In article <4.3.1.0.20000614111750.026c03a8@mail.hyro.com>,
scott.hutchens@hyro.com (Scott Hutchens) wrote:
> Is there a way for php to ask the browser if it has cookies enabled? If so,
> how?
Not directly. However, you could have this at the top of every file, and
on the *SECOND* page they visit, you'll know:
<?php
if ($CookiesOn){
echo "Cookies are on.<BR>";
}
else{
SetCookie("CookiesOn", 1);
echo "If this is the second page you've visited, your cookies are
off.<BR>\n":
}
?>
This is a limitation of how HTTP works, basically...
The fact that their cookies my be on/off is not transmitted until you fail
to get the cookie you set, because, for one thing, they may be deciding on
a site-by-site basis, or even a cookie-by-cookie basis to accept cookies.
You can't find out how they'll answer until they answer, which is after
you send the page.
Even then, I guess a user could accept your first cookie, but not the
others, so you wouldn't be sure they were accepting *ALL* your cookies...
But that would be pretty weird behaviour by a user, especially since you
should only be sending them one (1) cookie, and storing all the other data
for them in your server-side storage, preferably a database.
Bummer.
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)