alright so this is my code:
CODE
<?php
if(isset($_POST['checkage'])) {
$day = ctype_digit($_POST['day']) ? $_POST['day'] : '';
$month = ctype_digit($_POST['month']) ? $_POST['month'] : '';
$year = ctype_digit($_POST['year']) ? $_POST['year'] : '';
$birthstamp = mktime(0, 0, 0, $month, $day, $year);
$diff = time() - $birthstamp;
$age_years = floor($diff / 31556926);
if($age_years >= 18) {
setcookie('legal', 'yes', time() + 31556926, '/', '.'.$_SERVER['SERVER_NAME']);
# The above line sets a cookie called "legal" throughout the entire domain and its value is yes. The cookie will expire next year, if it is not manually deleted.
$url = '/home.html';
} else {
setcookie('legal', 'no', time() + 31556926, '/', '.'.$_SERVER['SERVER_NAME']);
# You're not old enough, come back next year!
$url = '/minor.html';
}
header('Location: '.$url.');
}
?>
but it gives me this error:
CODE
Warning: Unexpected character in input: ''' (ASCII=39) state=1 in C:\Users\emoruffino\Desktop\xampplite\htdocs\test\index.php on line 19
Parse error: syntax error, unexpected ')' in C:\Users\emoruffino\Desktop\xampplite\htdocs\test\index.php on line 19