I have code that sets a session cookie, but I want it to persist beyond the single session. Is there a way to do this, or how would I convert it to a regular cookie that I can set to a longer expire time?
This is the code I call in the primary page to check for the session (age validation)...
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]") );
Then from there, I call the following to check for the validation (form is not included as it is not necessary, but it creates the session cookie if yes is clicked).
<?php
session_start();
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;
}
if( isset( $_SESSION['age_verification'] ) and $_SESSION['age_verification'] != true ) die( header('Location: http://www.bing.com') );
?>
Any advice would be appreciated.