Quick Start Guide

AgeLock setup is easy and will take less only a few minutes to drop into your existing code base.

Step One – Install AgeLock

You need to copy the AgeLock files to your server.
When you download and unzip AgeLock there will be two folders; documentation and agelock

Copy the agelock folder to the your webserver using a FTP client, or your webhost (contact your webhost for help regarding this.)

Ideally AgeLock should be saved to the root directory, which will mean that if your website site is http://www.example.com the agelock files will be uploaded to http://www.example.com/agelock/

Step Two – configuration

AgeLock is highly customisable so that you can get the most out of the script before having to touch the code.  Not all the setting however need updating, here are a main items to update when first installing AgeLock to get you up and running quickly.

installed_folder – should be something like ‘http://www.yoursite.com/agelock/’;

minimum_age_in_years – 18;

maximum_age_in_years – 200;

success_page – something like ‘http://www.yoursite.com/restricted-content/’;

simple_check – true;

To update a setting open the file called agelock.php, held within the main agelock folder, using your favourite text editor such as Notepad for Windows or TextEdit for Mac. These options can be found in the top section of the agelock.php file where they are clearly documented with explanation about each option. Find the options listed above and change the text/values to whatever you wish.
For example if you wish the minimum age that users should be to access your content to be 13 you should update line 28 of agelock.php to from this:

line 28

To this:

line 28 version 2

The above configuration suggested above will generate a simple page on which the user will have to answer yes or no that they are 18+ years old. To change from a simple button press to validate the users age by making the user to enter their birth date change simple_check to false;

$agelock_settings[‘simple_check’] = false;

Step Three – Turn on AgeLock

Next you need to protect your files.
To do this open the file that you wish to protect with a text editor and add a line of PHP code to the very top of the file. Like the below.

<?php include 'http://www.yoursite.com/agelock/agelock.php'; ?>

Where www.yoursite.com is your sites website address and you have saved the agelock folder in the root directory.

If you encounter an error message similar to “URL file-access is disabled in the server” try the below, or use relative html links.

<?php include($_SERVER['DOCUMENT_ROOT']."/agelock/agelock.php"); ?>

Unfortunately AgeLock can only protect PHP files.
If the file you want to protect is not a php file already, you can convert it by changing the file name so that it ends with .php, instead of .htm or .html.

Step Four – Done!

Time to test AgeLock. Try the visit one of your protected pages. You should now be redirected to an AgeLock page and asked to confirm that you are the correct age to access the webpage.

Was this article helpful to you? Yes 1 No

How can we help?