I have the following code in my "top_nav.php" page. This top nav is included on all pages in the website.
<?php if (isset($_COOKIE['masondisclaimer']) && $_COOKIE['masondisclaimer'] == 'yes')
header("what to put here");
else
{
header("Location: /disclaimer.php");
exit;
}
?>
On each page I have
<?php include('../nav2/top_nav.php'); ?>
(or some variation of)
I receive the following error
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/probation/index.php:12) in /var/www/html/nav2/top_nav.php on line 2
How can I fix this? What I am trying to do is check for the cookie on each page, if it exists then allow the user to view the page normally. If it does not exist then redirect them back to the disclaimer page.