Without reading your code, I can't tell you exactly what is going on or the best way to solve your problem.
Instead of using include() you can do a jump to your page:
<?
// Jumps have to be placed before you write any HTML
$loc = "index.php";
header("Location: $loc\n");
exit;
?>
Otherwise use an if statement to ignore the portion of your script that sets the cookie.