If have 2 errors:
Invalid argument supplied for foreach()...
Use of undefined constant c - assumed 'c' in...
I first am trying to find if the cookie exists. Then if a duplicate cookie exists in the array.
I was looking at other examples on here, but they seems to show the same foreach loops. Is there something I am missing?
$seo = "perma-link"
$count = 0;
$duplicate = 0;
if (isset($_COOKIE['c'])) {
foreach($_COOKIE['c'] as $key => $value) {
if($value === $seo){
$duplicate = 1;
}
}
} else {
setcookie(c[$count], $seo, time()+3600);
$duplicate = 1;
}
if($duplicate == 0){
$count = count($_COOKIE['c']);
setcookie(c[$count], $seo, time()+3600);
}