My 2p:
It's difficult to stop under 18s from entering a site. You probably need to include a disclaimer and link, on a splash page/landing page. Once link is pressed, set a session variable to allow pages to be seen. On logout, session is destroyed. [You could also destroy an existing session if the referring page is outside the domain or does not exist - but this breaks if you manually enter an url or possibly use a bookmark]. If session is not present on any page, header redirect to the splash page.
I was playing with something similar here (I have a session implementation on http://diafol.org/blacknun/blacknun/index.php ) It's just something I was playing with. It doesn't have the referer implementation, but as I say, it's not foolproof.
4 pages:
top of splash screen:
redirect to main page if a session is set
the page has link to accept_page
session_start();
if(isset($_SESSION['adult'])){
header("Location: index.php");
}
top of site pages:
redirect to splash screen if no session set
session_start();
if(!isset($_SESSION['adult'])){
header("Location: splash.php");
}
top of accept_page:
set session var and redirect to main page
session_start();
$_SESSION['adult'] = 1;
header("Location: index.php");
logout page
kills session and redirects to main page - which should redirect to splash page (you could set redirect to splash page)
session_start();
session_destroy();
header("Location: index.php");
BTW, each header() should be succeeded by an exit();
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080