Hi Guys,
I’m trying to set a cookie but it keeps expiring as soon as its made and i cant work out why. Below is my code:
//set new cookie signup
$expire=time()+60*60*24*30;
$parts = explode(".", $_SERVER["HTTP_HOST"]);
$parts_size = sizeof($parts);
$domain = "." . $parts[$parts_size - 3] . "." . $parts[$parts_size - 2] . "." . $parts[$parts_size - 1];
setcookie("site_reg", "$leadid", $expire, "/", $domain);
As you can see the cookie should last for 30 days and only expire once it has gone past the 30 days. But for some reason it expires right away. I’m using HTTPFOX (FireFox Addon) which is showing me debug and cookie information and can see the expiry of the cookie is the same time the cookie is made. Any help would be great.
Thank you!