Need to test for Cookies

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TG

    Need to test for Cookies

    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

    #2
    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

    Comment

    • Louis Aslett

      #3
      Re: Need to test for Cookies

      "TG" <tgillette1@cox .net> wrote in message news:<MMCYb.644 7$Dc2.1966@lake read01>...[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_tr ans_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

      Comment

      Working...