// if env var is set and no session var, then not accepted if (getenv('PHP_ckset') == true && !isset($_SESSION['foo'])){ echo 'cookies not accepted'; } // if env var isn't set, and no session var, then set env var, and session value elseif (!getenv('PHP_ckset') && !isset($_SESSION['foo'])){ $_SESSION['foo'] = true; putenv('PHP_ckset=true'); header("Location: " . $_SERVER['PHP_SELF']); exit; } // else all is quiet on the eastern front else{ echo "cookies accepted"; }