Category Archives: php

Age Verification Script and Tutorial

Elysian Brewing Age Verification Page

Elysian Brewing Age Verification Page

*7/27/2013 UPDATE – I have received so many inquiries and questions on this topic that I’ve decided to turn this in to a service that I offer. ¬†Please go to http://age-verify.com for complete details.

Currently I am in the midst of a fair amount of work for Elysian Brewing. The most recent piece in place is an age verification script that is a simple yes / no question to the user which sets a session cookie and then directs them accordingly. Sounds simple right? Well, not as simple as you might think.

Considerations and Requirements

  1. This is a pretty big site and changing the site root index.html page to be the actual verification page would mean the undoing of established search engine results and crawl data.
  2. Even if I did use the site root page for age verification, every page on the site (not to mention external links), would need to have the link back to root updated with a new location if the page extension were to change.
  3. I want to prompt for the age verification regardless of what page the site visitor first gets to.  They may not necessarily come in at the site root, but rather from a blog posting, searching for a brewery location, beer profile page, etc.
  4. I only want users to be prompted once per site visit, but not every time they navigate to a different page within the site.
  5. To accomplish #3 and #4, I’ll need to set a session cookie with a server side language such as PHP.
  6. I don’t want to change any of my page extensions from .html to .php for the same reason listed above in item #2.

Check out the Elysian Brewing website to see this live and in action. Elysian Brewing

Gregg