session cookies in IE7 not working

I have a website I've developed and I'm having problems with IE7 recognizing the session cookies. It worked in the earlier version of IE, it works in all other browsers. I've changed the setting in IE7 to "Accept All Session Cookies" and it still won't work. Is there something I need to do differently with my coding to accomodate the new IE7 session cookie standards

Here is my code to set the session cookies:
if(isset($_POST['Submit'])) {
if($_POST['pUsername']=="$op_email" && $_POST['pPassword']=="$op_password") {
$query="SELECT other_parent_first_name, parent_id, op_email, op_user_level FROM parent_units WHERE op_email='$op_email' AND op_password='$op_password'";
$result=mysql_query($query);
$row=mysql_fetch_array($result, MYSQL_NUM);
if($row){
session_set_cookie_params(604800,'','');
session_start();
$_SESSION['logged']=1;
$_SESSION['name']=$row[0];
$_SESSION['parent_id']=$row[1];
$_SESSION['email']=$row[2];
$_SESSION['user_level']=$row[3];
header('Location: http://www.lapp.coop/parent/index.php');
exit();


Answer this question

session cookies in IE7 not working

  • Chris.P.J

    Hey

    I also have the same problem. My cookies worked fine with IE7 untill i installed .NET 2.0 on my PC. This worked fine untill IE& with .Net 2.0:

    < php
    header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
    header("Set-Cookie: SIDNAME=$overwrite; path=/; secure");
    header('Cache-Control: no-cache');
    header('Pragma: no-cache');

    >

    Why is IE7 so full of S***. Everything worked fine with Firefox and every other browser I tried, but not with IE7.

    Anyone with any help


  • Pilot_cir

    Hello,

    Did you fix your IE7 SessionID cookie problem Because I have a similar problem with the IE7 trying to create some cookies. I have a webpage that was working fine for 3 months, and it has some problems since a couple of weeks ago. I traced the problem to the creation of the cookies with IE6 and IE7.

    Any help will be wellcome.

    Thx in advance.



  • mshvw

    Robert,

    I'm having a similiar problem with IE7 and it losing the SessionID cookie.

    I looked at your solution, but i'm not really sure if it applies to me. I have a simple Session["xyz"] ="xxx" in page A, and then later in page B when i try to read it, i get null.

    It works fine in Firefox but not in IE 7. I'm guessing its because IE 7 does not send the SessionID cookie with the request and hence can't retrieve the proper session value.

    How do i apply your solution in my case


  • rtaiss

    Hey there,

    The problem that you are experiencing can be solved in 3 ways see which one works for you.

    1. Try to add session_write_close() (http://nl3.php.net/manual/en/function.session-write-close.php) before doing a header location

    2. If you set your cookie params with session_set_cookie_params(604800,'','') you do not enter a path. This sometimes gives problems with IE7

    3. Add the following cache header in you php Header("Cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, private");

    Hopes this helps you.

    Regards,

    Robert.


  • etcheverrjc

    Please do not send post-check=0, pre-check=0. These directives do not do what you expect.
  • CJira

    Hi,

    Well, at the end of it all i started using PHP session cookies, it works.

    Thanks,
    Marjo van Lier

  • robo2x

    Did you changed the header information to:

    Header("Cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, private");

    Without the post-check=0, pre-check=0. Like EricLaw-MSFT noted in the previous post.

    What also helps is to use an P3P policy. In this policy you tell the visitor what you do with the saved information.

    If this is availble IE will also more likely accept any cookies. Although i don't know this will apply on this issue. But it's word a try right

    Try reading the header information. This is mine:

    HTTP/1.0 200 OK
    Date: Mon, 04 Feb 2008 17:08:49 GMT
    Server: Apache
    Set-Cookie: PHPSESSID=23af0b99a68773a32967648ddc9954ab; path=/
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Set-Cookie: iLanguageID=deleted; expires=Sun, 04-Feb-2007 17:08:48 GMT; path=/
    Set-Cookie: sLanguageISO639=deleted; expires=Sun, 04-Feb-2007 17:08:48 GMT; path=/
    Content-Language: nl, es, no, fi
    P3P: policyref="http://www.eurocampings.net/w3c/p3p.xml", CP="ALL DSP COR NID CUR OUR IND PUR"
    Content-Length: 3874
    Connection: close
    Content-Type: text/html

    You can check it here: http://www.hashemian.com/tools/browser-simulator.htm

    Hope it helps.

    Cheers!

     
     
     


  • Rick Hill

    Hi ,

    Did you find a workaround for this problem by any chance

    Im seeing the same issue only in IE7...

    Thanks

    Maire


  • ITsAlive

    Hey there,

    I'm experiencing the same problems as discussed in this thread, but I am using ASP.NET and C# and built in functionalities of the .NET framework to place the session cookie...

    Btw. I am using .NET 2.0

    System.Web.Security.FormsAuthentication.SetAuthCookie(tbUsername,false);

    This works in Firefox and ie6, but not in ie7...

    Any suggestions



  • Jim Perry

    What do the HTTP headers sent from the server application look like (Just copy the headers using Fiddler http://www.fiddlertool.com/)
  • session cookies in IE7 not working