Load site based on cookie value in PHP
+3
−0
I need to load a site based on a cookie. I wrote code to validate that, like this.
if(!isset($_COOKIE['cookie'])){
$domain = $_SERVER['SERVER_NAME'];
setcookie('cookie', $cookie, time() + 31536000, '/', $domain);
header('Location: '.$_SERVER['REQUEST_URI']); // reload
}
But when the cookie was created the first time I got this error:
1 comment thread