mottwsc Posted March 18, 2010 Share Posted March 18, 2010 I need to have users accept cookies for my application and I'm trying to determine if a user's browser is set to accept cookies. On the initial display of the login page, I clear any old cookie and then set a new cookie (see below - Part 1). After the user enters login and password info and submits the form, the program goes back to the login page php logic to check if the cookie was set. If not, an error message is displayed (see below - Part 2). The problem is that on MSIE (after I change settings to NOT accept cookies), it blows by this Part 2 test without being caught. The cookie ends up being written (per my debug statements) even with settings to accept cookies being turned off, but I can't find any cookie. This works when I turn off cookies in Firefox. In addition, when I turn off cookies in MSIE and then try to sign into Yahoo, it blocks the sign in because cookies are not being accpeted, so I know that cookies are not being accepted. Is there something I'm doing wrong in the code? Where should I be able to find the cookie that is set? Any other suggestions on how to resolve this? Thanks! # Part 1 - On the initial display of the login page, I clear any old cookie and then set a new cookie if (isset($_COOKIE['Test'])) { setcookie('Test', '', time()-42000, '/'); } print "after cookie was cleared"; var_dump ($_COOKIE); setcookie('Test', 1); print "after cookie set"; var_dump ($_COOKIE); exit(); # ------- # Part 2 - After login info is entered, the program goes back to the login page php logic to check # if the cookie was set. If not, an error message is displayed. var_dump ($_COOKIE); exit(); if( !isset($_COOKIE['Test'])) { errorMessage... } Link to comment https://forums.phpfreaks.com/topic/195692-problem-with-cookies-on-msie/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.