Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on Load site based on cookie value in PHP
Post
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