Web Hosting Talk







View Full Version : Cookie based warning screen - HELP


enricoeur
01-07-2008, 06:59 PM
Hi

i want to create an warning screen or age check verification page for protect some sections of my website that contain adult explicit contents. I'm looking for something similar to youporn.com. A terms and condition screen that appear only once when the user connect to the website and is invisible until the user don't close the browser....

Do you have any good resources and tutorials for do this job ?


Thanks in advance
Enrico

liam_tmt7
01-07-2008, 07:32 PM
You could just create it as a static page, without cookies.

So when a user naviagtes to the page, they are confronted with the option to either enter(yes) or Leave(No) and when they leave then they are taken back to the homepage of your site.

Liam

Payton Designs
01-07-2008, 08:04 PM
I agree with Liam. Use a static page that is displayed every time any user accesses your web page. If they click Agree, they will be directed to your content, if they click No, you could make it redirect elsewhere or close the browser window.

Paul-M
01-07-2008, 09:12 PM
In this situation, a static page is probably the best option.

hsbsitez
01-07-2008, 09:21 PM
It will be useful if you can state: if you know how to set a cookie or not.

At the beginning of the page, just use if statement to check if the cookie is set. If it is not, then have an include statement where it asks the user for their age. Then use the page to check if their 18+ or not.
If not, then dont create the cookie, otherwise create the cookie, and then send the user back to their default page (I recomend returning to the referrer).

Basic line:

if( !$_COOKIE[$cookie_name])
{
include($_SERVER['DOCUMENT_ROOT'].'/age_verification.php');
exit;
}