Hi all,
I'm trying to implement some age verification script for a beer-related site. However, when I add the script to create an array before anything else in the header, I get an error, saying the header has already been sent...
Here is the code I'm using:
<?php
session_start();
$unprotected_pages = array('/ageGate.php', '/terms.php', '/underage.php');
if ((!in_array($_SERVER['PHP_SELF'], $unprotected_pages)) && (empty($_SESSION['age_verified']))) {
header("Location: http://{$_SERVER['SERVER_NAME']}/ageGate.php");
exit;
}
?>
Any thoughts on how I could make this work?
Thanks!
HFF