try this one
<?php
$allowed_age = 19;
$bdate = strtotime($_REQUEST['y'].'-'.$_REQUEST['m']."-".$_REQUEST['d']);
$age = (time()-$bdate)/31536000;
if($age >= $allowed_age) {
header('Location: http://www.URL.com/Tour/Tour1.html');
exit;
}
else {
header('Location: http://www.URL.com/notvalidbday.html');
exit;
}
?>
This works fine. Thanks. I was trying to add set cookie to expand on this, which works, but resets the cookie value each time. I want to check if someone has already entered their age and if so, direct them to the appropriate response page. i.e. - don't want a youth hitting back button and enter different age. I know this is easily circumvented anyways, but ESRB requires it for adult game trailers, etc. Here is what I have so far -
<?php
$allowed_age = 18;
$bdate = strtotime($_REQUEST['year'].'-'.$_REQUEST['month']."-".$_REQUEST['day']);
$age = (time()-$bdate)/31536000;
if($age >= $allowed_age) {
setcookie('legal', 'yes', time() + 31556926, '/', '.'.$_SERVER['SERVER_NAME']);
header('Location: http://www.myserver.com/adult.html');
exit;
}
else {
setcookie('legal', 'no', time() + 31556926, '/', '.'.$_SERVER['SERVER_NAME']);
header('Location: http://www.myserver.com/minor.html');
exit;
}
?>
Here is what the cookie looks like if I retrieve it -
for minor:
noArray ( [0379923826258bc7cbcfa89cd386917d] => e33f27206e07981d495d11f70581e790 [29e6895b11c34b79d161fe2a6f1702f0] => b7b4ff91eb8090ad2f85d6a2100d3c4e [legal] => no )
for adult:
yesArray ( [0379923826258bc7cbcfa89cd386917d] => e33f27206e07981d495d11f70581e790 [29e6895b11c34b79d161fe2a6f1702f0] => b7b4ff91eb8090ad2f85d6a2100d3c4e [legal] => yes )
Thanks for any help in advance!