Okay I created an age gate that runs the age calculation from the form fine, but as soon as it starts working with the redirect things go crazy. First of all when I load up the verify.php page on my localhost it first reloads the page when I hit the submit button after filling out the age information. Then I do it again and the redirect works? It works when taking me to the outside website, but then when I actually get the age verification correct it takes me to index.php but then index.php redirects me to the verify.php page again until the browsers start to complain about the redirect cookie issue. I don't get why its not creating the session at least temporarily.
so I have the php in the verify.php form page so its all on the same page here
VERIFY.PHP
<?php
session_start();
if(isset($_SESSION['verifyok']))
{
header("location: index.php");
exit(0);
}
if(isset($_SESSION['verifyfail']))
{
header("location: http://www.centurycouncil.org/");
exit(0);
}
if($_POST)
{
$remember = $_REQUEST ['remember'];
$day = $_POST ['day'];
$month = $_POST ['month'];
$year = $_POST ['year'];
$country = $_POST ['country'];
$birthday = mktime(0,0,0,$month,$day,$year);
$difference = time() - $birthday;
$age = floor($difference / 31556926);
if($age >= 21)
{
$_SESSION ['verifyok'] = 1;
header ("location: index.php");
exit(0);
}
else
{
$_SESSION ['verifyfail'] = 0;
header("loaction: http://www.centurycouncil.org/");
exit(0);
}
if($remember == 'save')
{
setcookie("verifyok", 1,mktime(0,0,0,01,01,date("Y")+30));
$_SESSION ['verified'] = 1;
header("location: index.php");
exit(0);
}
}
?>
INDEX.PHP
<?php
session_start();
if(!isset($_SESSION['verifyok'])){
header("location: verify.php");
exit;
}
?>
Thanks in advance for the support!