Jump to content

Php Cookies Not working throughout Domain


Joesavage

Recommended Posts

I am trying to use  a cookie to tell when someone has already been to my website. Right now the problem is that if the cookie gets set on one page, it does not get read by other pages.

$Affcookie = 0;
$Affcookie = $_COOKIE["track"];
if ($Affcookie == 0)
{
$Cookvar = 1;
$Expire = time() + 60*60*24*60;
setcookie("track", 1, $Expire);
}
if ($Cookvar == 1;)
{
echo 'blah';
}

Right now if I go to a page on my domain it first echoes 'blah' and then if i refresh then it doesnt echo, which is correct. But if I go to any other page on my domain then once again 'blah' is echoed. All pages have this is same piece of code on them. So they all check to see if the cookie[track] = 1.

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.