PHP Library Installation Instructions

Downloads

Download PHP Files

Description

The Are You a Human PHP library allows you to easily add a PlayThru CAPTCHA alternative to forms on your website. It works with POST and GET requests and the workflow is similar to other human-verification solutions (e.g., ReCAPTCHA).

Requirements

The Are You a Human PHP library requires PHP5.

Site Keys

If you have not already done so, please create an account and add a site on which you plan to have a PlayThru;.

How to Configure

Before you can use a PlayThru, you need to:

  • Copy the files in the zip file into a directory on your web server.
  • Edit the "ayah_config.php" file to use your publisher key and scoring key.

How to Install

Below is a simple example implementation script. It assumes that the AYAH files are in the same folder and that you have already followed the "How to Configure" instructions above.

<?php
// Instantiate the AYAH object.
require_once("ayah.php");
$ayah = new AYAH();

// The form submits to itself, so see if the user has submitted the form.
if (array_key_exists('my_submit_button_name', $_POST))
{
        // Use the AYAH object to get the score.
        $score = $ayah->scoreResult();

        // Check the score to determine what to do.
        if ($score)
        {
                // Add code to process the form.
                echo "Hello ".$_POST['name'].", You are a human!";
        }
        else
        {
                echo "You are NOT a human!";
        }
}
?>

<!-- Build the form tag. -->
<form method="post">
        <!-- Build a form field. -->
        <p>Please enter your name: <input type="text" name="name"></p>

        <?php
            // Use the AYAH object to get the HTML code needed to
            // load and run the PlayThru.
            echo $ayah->getPublisherHTML();
        ?>
        
        <!-- Include a submit button. -->
        <input type="Submit" name="my_submit_button_name" value=" GO ">
</form>

Troubleshooting

If PlayThru isn't loading for you, please check the following:

  • If PlayThru is set to "Lightbox" mode, it will only display once the form it's included in has been submitted. You can see which mode PlayThru is set to in the "Game Style" section of the Dashboard.
  • Make sure that you are using the correct publisher key and scoring key.
  • Check to see if your server and/or network has a firewall which prevents outbound connections via port 443.

If you need further support, head on over to our Support Center. We'd be more than happy to help you out!

Installation Support

If you run into any issues during your installation process please use our support forums. We appreciate all feedback and are ready to help! Follow us on Twitter and Facebook for PlayThru™ updates.