SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2012
    Location
    Republic of Ireland
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Setting session.cookie_domain Not Recognised by IE

    My $_SESSION cookies are working fine in Firefox, Chrome, Safari and Opera but not in IE, which only sets the TLD and a forward slash for path. For instance, having specified my domain as 'example.net' with session.cookie_domain and the path as /whatever/ with session.cookie_path in the php.ini file, the cookie looks like this in IE:

    NAME display
    VALUE 205fce58a70be18da6cf33a96ebb9877
    DOMAIN .net
    PATH /
    EXPIRES At the end of the Session

    Various $_SESSION cookies I checked out from other sites also look like this in IE. Are we overlooking something essential about declaring a session or is this another IE issue?

  2. #2
    SitePoint Mentor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,257
    Mentioned
    32 Post(s)
    Tagged
    5 Thread(s)
    Have you tried setting the domain to '.example.net' (note the period in front of the domain)?

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2012
    Location
    Republic of Ireland
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by fretburner View Post
    Have you tried setting the domain to '.example.net' (note the period in front of the domain)?
    Yep. I've tried just about every permutation I can think of including 'www.example.net' as well as '.example.net' but IE just will not play ball with my sessions. Also '/whatever/' gets truncated to '/' which isn't very useful.

    It's very frustrating because of course the sessions will not work despite the cookies being set.

  4. #4
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Try setting P3P Headers. (W3C Standard that IE supports)
    PHP Code:
    header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'); 
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2012
    Location
    Republic of Ireland
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by logic_earth View Post
    Try setting P3P Headers.
    Thanks for that advice and my apologies for not responding earlier: I haven't been at my desk since my last post to this thread.

    I tried setting the header as your example above at the top of the PHP file I run when the page loads and I also tried it with a few other preference settings in case your example was disagreeable to Medium High privacy on IE8. I also tried setting it via .htaccess like so:
    Code:
    <ifModule mod_headers.c>
        Header append P3P 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'
    </ifModule>
    Neither method made a difference.

    Since I'm unfamiliar with P3P, I read up on the spec and I'm now wondering if this is enough or do I need to supply a privacy policy, which would be a bit much, frankly, since the cookie is only required for temporary data collection during form validation.

    Also I'm not clear why IE does this to session cookies when it doesn't mess up the parameters of a standard cookie that I also set on this site.

  6. #6
    SitePoint Enthusiast
    Join Date
    Oct 2012
    Location
    Republic of Ireland
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Enver View Post
    I tried setting the header as your example above at the top of the PHP file I run when the page loads and I also tried it with a few other preference settings in case your example was disagreeable to Medium High privacy on IE8. I also tried setting it via .htaccess like so:
    Code:
    <ifModule mod_headers.c>
        Header append P3P 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'
    </ifModule>
    Neither method made a difference.
    To be more precise, either method will set the header. Web Developer Tools in Firefox display the Response Headers as:
    Code:
    Server: Apache/2.4.4 (Unix)
    P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
    Last-Modified: Fri, 05 Apr 2013 17:28:09 GMT
    Keep-Alive: timeout=15, max=98
    Etag: "2bfc-4d9a069319653"
    Date: Thu, 09 May 2013 17:09:46 GMT
    Content-Type: image/jpeg
    Content-Length: 11260
    Connection:  Keep-Alive
    Accept-Ranges: bytes
    The trouble is that Internet Explorer 8 remains resolutely unimpressed.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •