The only other trick is deleting the pieces correctly.Sessions are better, but if they are not available this is a viable alternative.

invalidating a session in javascript-52invalidating a session in javascript-28invalidating a session in javascript-61

something that wasn't made clear to me here and totally confused me for a while was that domain names must contain at least two dots (.), hence 'localhost' is invalid and the browser will refuse to set the cookie!

instead for localhost you should use make your code work on both localhost and a proper domain, you can do this: If you're having problem with IE not accepting session cookies this could help: It seems the IE (6, 7, 8 and 9) do not accept the part 'Expire=0' when setting a session cookie. The default behavior when the 'Expire' is not set is to set the cookie as a session one.

Instead use $_SERVER['HTTP_COOKIE'] as it mirrors the actual HTTP Request header.

If you are having issues with IE7 and setcookie(), be sure to verify that the cookie is set via http for http sites, and https for https site.

Using array names was impractical and problematic, so I implemented a splitting routine.

I do not serialize any class instances, just arrays and simple objects.The relationships between the various maladaptive behaviors associated with BPD, elucidated through a behavioral lens, highlight the clinical utility of ongoing behavioral assessment for the treatment of the problem areas associated with BPD.) will make the cookie available to that subdomain and all other sub-domains of it (i.e. To make the cookie available to the whole domain (including all subdomains of it), simply set the value to the domain name ( the cookie will be made accessible only through the HTTP protocol.This means that the cookie won't be accessible by scripting languages, such as Java Script.It has been suggested that this setting can effectively help to reduce identity theft through XSS attacks (although it is not supported by all browsers), but that claim is often disputed. Note that the value portion of the cookie will automatically be urlencoded when you send the cookie, and when it is received, it is automatically decoded and assigned to a variable by the same name as the cookie name.On high traffic sites, this can substantially increase the size of subsequent HTTP requests from clients (including requests for static content on the same domain).