468,532 Members | 1,797 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,532 developers. It's quick & easy.

Need to test for Cookies

TG
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.
Jul 17 '05 #1
2 1647
"TG" <tg********@cox.net> wrote:
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.


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

HTH;
JOn
Jul 17 '05 #2
"TG" <tg********@cox.net> wrote in message news:<MMCYb.6447$Dc2.1966@lakeread01>...
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.


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
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by George Hester | last post: by
3 posts views Thread by Stephanie Stowe | last post: by
reply views Thread by Sri. | last post: by
1 post views Thread by Jon Cosby | last post: by
3 posts views Thread by Phillip N Rounds | last post: by
3 posts views Thread by Alex | last post: by
19 posts views Thread by Ganesh J. Acharya | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.