Hello there,
I need to load site based on cookie, i write 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 cookie created first time i got error.
I think header('Location: '.$_SERVER['REQUEST_URI']); execute multiple times, How to fix this ? its that right way to do ? or any other thing i need to change ?
Please advise, Thank you