Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WinXP + IE6 + PHP + Cookie = problem

Status
Not open for further replies.

rastkocvetkovic

Programmer
Aug 11, 2002
63
SI
I'm using Windows XP with Internet Explorer 6.0 and Apache server running PHP. Now, on any other platform and browser - it works fine - even on my machine - Netscape works perfectly.
Now, with IE6.0, I have set on "Accept All Cookies" - and even that doesn't help. I've already tried this P3P garbage which I found on one help page, but even that doesn't help. Here's the code:

// we send the cookie only with session_id (for a period of 3 hours)
header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'); //garbage for IE6.0
setcookie ("cookie_session_id" , "fa352456316ab", time() + 10800, "/");

I tried to retrieve the cookie with both ways:
echo &quot;Method 1 : &quot; . $cookie_session_id . &quot;<br>&quot;;
echo &quot;Method 2 : &quot; . $_COOKIE[&quot;cookie_session_id&quot;];

, but none of this methods have worked.

Thanks in advance for help!

 
Have you tried setting the domain in your setcookie() invokation? ______________________________________________________________________
TANSTAAFL!
 
Hi, sleipnir214

Yes, I've tried all variation that are possible. The list is here:
setcookie (&quot;cid&quot;, &quot;smthng&quot;, time()+1000);
setcookie (&quot;cid&quot;, &quot;smthng&quot;, time()+1000, &quot;/&quot;);
setcookie (&quot;cid&quot;, &quot;smthng&quot;, time()+1000, &quot;/&quot;, &quot;.com&quot;);
setcookie (&quot;cid&quot;, &quot;smthng&quot;, time()+1000, &quot;/&quot;, &quot;pizzerije.com&quot;);
setcookie (&quot;cid&quot;, &quot;smthng&quot;, time()+1000, &quot;/&quot;, &quot;pizzerije.com&quot;);

On the manual for setcookie function ( it is said that &quot;time()&quot; in brackets fixes the problem, but it's not so in my case:

setcookie (&quot;cid&quot;, &quot;smthng&quot;, &quot;time()+1000&quot;);
setcookie (&quot;cid&quot;, &quot;smthng&quot;, &quot;time()+1000&quot;, &quot;/&quot;);
setcookie (&quot;cid&quot;, &quot;smthng&quot;, &quot;time()+1000&quot;, &quot;/&quot;, &quot;.com&quot;);
setcookie (&quot;cid&quot;, &quot;smthng&quot;, &quot;time()+1000&quot;, &quot;/&quot;, &quot;pizzerije.com&quot;);
setcookie (&quot;cid&quot;, &quot;smthng&quot;, &quot;time()+1000&quot;, &quot;/&quot;, &quot;pizzerije.com&quot;);

I've also tried everything with and without P3P IE6.0 garbage:
header('P3P: CP=&quot;NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM&quot;');

But, nothing seems to work, nothing. In Netscape the thing works. Strange indeed!
 
That was me ofcourse, I forgot to log in... Wonder if that has something to do with cookies :)
 
Your time()+1000 shouldn't be inside quotes. That parameter should be an integer, not a string. ______________________________________________________________________
TANSTAAFL!
 
It may have something to do with the settings of your browser.

Here's my code:

Code:
<?php
setcookie (&quot;foo&quot;, &quot;somedata&quot;, time()+1000, &quot;/&quot;);
print_r ($_COOKIE);
?>

Using IE 6.0.2600.0000 and Opera 6.05, the first time I hit the page I get &quot;Array()&quot;. When I refresh, I get &quot;Array ( [foo] => somedata ) &quot;.
______________________________________________________________________
TANSTAAFL!
 
Hmm, the hughie@hughie.net says it fixes the problem for him on IE6.0. (CONTROL+F on I thought it was strange too, and it doesn't work either. This is really getting on my nerves. Maybe this has something to do with the fact, that the cookie comes from subdomain but the cookies are also retrieved from this subdomain only. Weird.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top