Not sure if this is the correct location for this or I should open a new thread, but I am encountering the following issue with a PHP based age verification: I am placing the following code in index.php
PHP Code:
session_start();
if(! isset( $_SESSION['age_verification'] ) or $_SESSION['age_verification'] != true ) die( header("Location: checkage.php?
url=http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]") );
//session_destroy(); //
echo 'hello over 18 person';
Then I am placing a file called checkage.php in the root folder of my cart with the following code:
Code:
<?php
// checkage.php
session_start();
// checkage.php
if( isset( $_POST['yes'] ) )
{
$_SESSION['age_verification'] = true;
if( isset( $_GET['url'] ) )
{
die( header('Location: ' . $_GET['url'] ) );
}
else
{
die( header('Location: index.php') );
}
}
elseif( isset( $_POST['no'] ) )
{
$_SESSION['age_verification'] = false;
}
// The below line will check if someone has already said no so you can show them a page which tells them to they are too young.
if( isset( $_SESSION['age_verification'] ) and $_SESSION['age_verification'] != true ) die( header('Location: http://www.google.com'
);
?>
<form method="POST" >
<fieldset>
<legend>Are you over 18?</legend>
<input type="submit" name="yes" value="Yes" /> <input type="submit" name="no" value="No" />
</fieldset>
</form>
It gives me a 500 internal error. Any suggestions as to what I'm doing wrong?