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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.