Re: How to tell if client has cookies turned off?
| From: | Rick St Jean | Date: | Tue, 06 Mar 2001 17:34:32 +0000 |
| Subject: | Re: How to tell if client has cookies turned off? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42783@lists.php.net to get a copy of this message | ||
you can check the HTTP_COOKIE_VARS array after setting a cookie to see
if anything is placed in there.
Rick
At 08:52 AM 3/6/01 -0800, Chris Adams wrote:
On 6 Mar 2001 07:53:46 -0800, kevin1 <kevin1@outcomemail.com> wrote:
How can I tell reliably if someone has cookies turned off?
Set a cookie on your site (perhaps the homepage?) and use code like this:
if (!empty($UserHasCookies)) {
echo 'Whew - you do have cookies';
}
The idea is to set your code to assume that cookie support is disabled unless
it finds a cookie saying otherwise. That way it'll fail safely if someone
either doesn't have a cookie or their browser discards the cookie halfway
through. This may seem silly, but some people get *really* paranoid about
cookies. Combined with the increasingly good cookie management in modern
browsers and just about anything is possible - this is in fact the major
shortcoming to code like the above - it's possible for someone to accept one
cookie and deny another, so just being able to set a cookie once does not mean
that you will be able to set another.
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
##########################################################
# Rick St Jean,
# rstjean@internet.look.ca
# President of Design Shark,
# http://www.designshark.com/
# Quick Contact: http://www.designshark.com/messaging.ihtml
# Tel: 905-684-2952
##########################################################