reCAPTCHA is good if your users speak English - they can guess the word, because they know it. Those who do not speak English, forced to guess each letter that is not always possible. There is a universal language that everyone knows: the mathematics. So I wrote a CAPTCHA script prompts the user to solve a simple equation:
captcha.zip (Size: 51.8 KB / Downloads: 24)
N.B. I assume that you are using Form Tools API method to submit your form.
To use it in your form, unzip and upload folder "captcha" to your webserver.
1) If you not using server-side validation.
1) If you using server-side validation
Now, if everything works right, you will see something like this:
You can tune CAPTCHA image by changing parameters in section "Config" in file "math_captcha.php"
captcha.zip (Size: 51.8 KB / Downloads: 24)
N.B. I assume that you are using Form Tools API method to submit your form.
To use it in your form, unzip and upload folder "captcha" to your webserver.
1) If you not using server-side validation.
- In you form, after:
add:PHP Code:$fields = ft_api_init_form_page(YOUR_FORM_ID);
next, after:PHP Code:$errors = array();
if (isset($_POST["NAME_OF_SUBMIT_BUTTON"]))
{
if ($_POST["math_c_val"] != $_SESSION["math_c_sum"])
{
$errors["math_captcha"] = "Sorry, you entered an incorrect CAPTCHA number.";
}
if (empty($errors))
{
add:PHP Code:ft_api_process_form($params);
PHP Code:}
else
{
$fields = array_merge($_SESSION["form_tools_form"], $_POST);
}
}
- To display error message on page, add somewhere after <body>:
PHP Code:<?php
if (!empty($errors))
{
echo "<div class='error'>Please fix the following errors:\n<ul>";
foreach ($errors as $error)
echo "<li>$error</li>\n";
echo "</ul></div>";
}?>
- Use this tutorial to re-fill fields if CAPTCHA entered improperly: Re-filling form fields using the API.
1) If you using server-side validation
- In you form, after:
PHP Code:$errors = validate_fields($_POST, $rules);
add:
PHP Code:if ($_POST["math_c_val"] != $_SESSION["math_c_sum"])
{
$errors["math_captcha"] = "Sorry, you entered an incorrect CAPTCHA number.";
}
Code:
Solve this simple equation: <img src="/captcha/math_captcha.php"> = <input type="text" name="math_c_val" maxlength="5" size="5">
Now, if everything works right, you will see something like this:
You can tune CAPTCHA image by changing parameters in section "Config" in file "math_captcha.php"