NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
debuging Internal browser and cookies


Joined: 27 Mar 2009
Posts: 1
Reply with quote
Hi, Im evaluating the trial version on my project and Im having trouble with cookies.

Ive set the project to use system default in the project options and I have set the ide tools default browser to use embedded mozilla.

The cookie dbg creates for the session appears in $_COOKIE

However I cannot get the following code to work either


$cookie_domain = HTTP_COOKIE_DOMAIN;
$cookie_path = HTTP_COOKIE_PATH;
setcookie('cookie_test', 'please_accept_for_session', time() + 60 * 60 * 24 * 30, $cookie_path, $cookie_domain);

( $cookie_domain = '' , $cookie_path = '/paysite')


if (isset($HTTP_COOKIE_VARS['cookie_test']))
or if (isset($_COOKIE['cookie_test']))

Having set the browser options to notify me to accept a cookie it dosnt even do that.

thanks
View user's profileFind all posts by GJ_ROSESend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7861
Reply with quote
You should not expect a cookie issued by the server to appear in the $_COOKIE array immediately. It may appear in the next request and it will happen only if the cookie is correct. Please take a time to learn how the cookies are working: http://tools.ietf.org/html/rfc2965 and http://en.wikipedia.org/wiki/HTTP_cookie
In short, suppose your server issued a cookie header, then after it is received by the browser, all _SUBSEQUENT_ requests that the browser will run against the same server will be accompanied with that cookie until the cookie has expired. If cookie is not set, check the headers with HTTP Watch or Live HTTP Headers plugins for the browsers (note: they will work only with EXTERNAL browsers, not with embedded, but after you get the cookies working in external, they will also work with embedded).

With your example, it's absolutely unclear what is in HTTP_COOKIE_DOMAIN and HTTP_COOKIE_PATH constants. I'd recommend you not to use them at all. Set path to "/" and empty domain. Browsers are good enough to assign appropriate domain for the cookie they get from server because browsers always know the URL and the domain.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
debuging Internal browser and cookies
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic