Page 1 of 1

Cookie code works here, but not there?

Posted: Fri May 25, 2007 5:10 am
by JAB Creations
This snippet is supposed to create a cookie that lives for a month. It has worked just fine for countless months thus far. Now when I use it suddenly the cookies die in seconds of their creation. The only difference I am aware of is the fact that they are created after the page request method is post instead of get. I've changed the form method to get (from post) but receive the same results. There is nothing referring to setting a cookie other then the snippet below so it has to be some sort of rule in regards to cookies that I'm missing?

Code: Select all

<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
 if(isset($_POST['chatroom']) && $_POST['chatroom']=='1')
{setcookie('chatroom','1',time()+2592000,'/');}
else if ($_SERVER['REQUEST_METHOD'] == 'POST' && !isset($_POST['chatroom'])) {
setcookie('chatroom','0',time()+2592000,'/');}
}
?>

Posted: Fri May 25, 2007 8:21 am
by feyd
Is the cookie being added to the response headers? Is the cookie's domain improper?

Posted: Fri May 25, 2007 3:38 pm
by JAB Creations
Ah, I knew it was something retarded, but I underestimated just how dense the retardation was! The chat room (php Free Chat) was deleting my cookie! WTF! 8O Well that's why I've been referring to it as experimental...