Jump to content

Deleting/Editing Cookie Set in Javascript With PHP


jackpf

Recommended Posts

Hi all,

I'm currently having a bit of a problem editing and deleting a cookie I set in javascript with php. I'm attempting to allow the user to update their cookie in real time or via php. But if the cookie is created with one language, it's not accessible in the other.

 

Here's my javascript::

var post = $_GET('thread')+'.'+document.forms[0].post.value; //$_GET is my javascript emulation of PHP's superglobal
var expire = new Date();
expire.setDate(expire.getDate() + 999);
document.cookie = 'jackpf_post='+escape(post)+'; expires='+expire.toGMTString()+'; path=/; domain='+window.location.hostname; //tried all sorts of stuff here, like '.jackpf.co.uk', 'jackpf.co.uk', 'www.jackpf.co.uk', false, etc....

 

And PHP, simply::

setcookie('jackpf_post', false, -1000, '/', '.www.jackpf.co.uk'); //fails

 

The cookie is definitely being set with the right values and stuff; I just can't modify it.

 

Any help is greatly appreciated,

Thanks, Jack.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.