Connecting Tech Pros Worldwide Forums | Help | Site Map

Need to test for Cookies

TG
Guest
 
Posts: n/a
#1: Jul 17 '05
How can I test to ensure a visitors browser allows for cookies? When I
recently setup my browser to not allow cookies and I visited my website my
global and session variables stopped working between pages. Once I set allow
cookies back on, it started working again.

Thanks in advance.



Jon Kraft
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Need to test for Cookies


"TG" <tgillette1@cox.net> wrote:
[color=blue]
> How can I test to ensure a visitors browser allows for cookies? When I
> recently setup my browser to not allow cookies and I visited my
> website my global and session variables stopped working between pages.
> Once I set allow cookies back on, it started working again.[/color]

Set a cookie, next page test for it, if it's not set display warning.

HTH;
JOn
Louis Aslett
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Need to test for Cookies


"TG" <tgillette1@cox.net> wrote in message news:<MMCYb.6447$Dc2.1966@lakeread01>...[color=blue]
> How can I test to ensure a visitors browser allows for cookies? When I
> recently setup my browser to not allow cookies and I visited my website my
> global and session variables stopped working between pages. Once I set allow
> cookies back on, it started working again.
>
> Thanks in advance.[/color]

I'm not sure that there is a straight-forward way to test from a
server-side language like PHP, because PHP has to choose to set the
cookie or not in the HTTP header, before content is sent out. This
kind of check is perhaps better suited to Java Script?

However, the php.ini setting "session.use_trans_sid" may be what you
are looking for - this will maintain your session information between
pages whether or not the browser supports cookies.

See http://uk.php.net/manual/en/ref.sess....use-trans-sid

Louis
Closed Thread


Similar PHP bytes