Tutorial: Using easiCaptchaM In Freeway Forms 




Home | easiCaptcha Example | easiCaptchaM Example | easiCaptcha | Buy easiCaptcha | Download FW Example | Contact Us | []







A captcha is a 'Completely automated public Turing test to tell computers and humans apart', you use them on web site forms to help prevent a 'bot' from using your form. Users now have two captcha options, an image or a math question which is dynamically created for your form. Depending on which option you use the form user has to answer a simple math question or enter the text shown on the image before submitting the form, so the script knows there is a good chance that the form has been submitted by a human.

easiCaptcha is a package of two captcha options that you can add to your web forms easily and quickly, it consists of 2 php script options with their configuration files and a decrypt loader folder that you can use to adjust the selected easiCaptcha's preferences... if you feel the need to. You need to have a php form processing script which is not covered in this tutorial but can be bought with easiForm as a bundle. We recommend using easiCaptcha with easiForm.

easiCaptcha costs $15 per domain.








Have a look at an: easiCaptchaM Example






What do I need to use easiCaptcha in Freeway?






NOTE: There are two versions of easiCaptcha in the easiCaptcha download, easiCaptcha which is the image based CAPTCHA and easiCaptchaM which is a math question based CAPTCHA. Both versions are included under the same license and easiCaptcha purchase.

This shows how to use the math question version of easiCaptcha, to see how to use the image version (easiCaptcha) then: Select here. The installation is very similer but there are a couple of small but important differences on the installation process.

This tutorial has been superceeded by the PHP easiCaptcha action, so if using Freeway Pro... see the PHP easiForm tutorial which has a section on adding the PHP easiCaptcha action at the end of that tutorial.

Note that easiCaptcha cannot be used with other form scripts unless they are altered for it's use, easiForm has been written to be compatible with easiCaptcha.

This now shows the installation of using the easiCaptcha image captcha scripts:

1# A copy of easiCaptchaM (Comes in the easiCaptcha download).

Download the easiCaptcha files on their own (Both image and math question versions) Download easiCaptcha Demo | []

or with the example we built in this tutorial. Download Freeway Example with easiCaptcha Demo | []

2# The server you place the easiCaptcha scripts on needs to have PHP 4.0.3 or above installed.

The GD library is not needed for the math question version as detailed on this page - easiCaptchaM.

If you use the easiCaptcha image version, PHP also needs to have the GD library installed and activated. (If PHP is installed then you will probably find that the GD library is installed also). If you are unsure then you can upload a phpinfo() script to your server, when uploaded you need to load it from an internet browser to see if you have PHP and if it has the GD library, or you can contact your ISP (Internet service provider) and ask them if PHP and the GD library are installed.

3# You need a web form, this can be written by hand, in Dreamweaver, in Freeway or any other program used to create web sites with, this tutorial is for Freeway.

4# A loader file to decrypt the easiScript, the loader used depends on the system and server type that the easiScript's are used on.

The default download of easiCaptcha includes the loaders needed for both Windows and Linux servers, if you need a loader for another server type such as OSX, FreeBSD, Solaris or other then those loaders can be downloaded from the ioncube loaders download page. If you are unsure as to which loader to use you can Download a folder that will check the loader you need, or if you are having problems you can Contact us. (We advise running easiCaptcha as a demo first before making a purchase, just to make sure your server is compatible with ioncube).

Two hosting companies that support ioncube loaders are have-host.com (James Wilkinson) and ineedwebhosting.co.uk (David Owen), an added advantage is that both companies owners are also Freeway users.

5# A copy of Freeway - Softpress

It can take as little as 15 minutes to set up your Freeway form with easiCaptchaM or easiCaptcha, even for the inexperianced.






Step 1: This code needs to be added to the very top of the form, before any other code:






Select: "Page > HTML Markup... > Insert: Before HTML" and paste the above code to the top of the text area as shown in the image to the right.


<?php include_once('easiCaptchaM_a.php'); ?>




Press 'OK' to close the HTML Markup window.


^-- Top








Step 2: This second bit of code adds the actual captcha to the form:






Select: "Insert > Markup Item... " and paste the following code in the markup window as shown in the image to the right.


<?php include_once('easiCaptchaM_b.php'); ?>




Press 'OK' to close the Markup window.


^-- Top















Now we need to move the markup item you have just created to the position on the form where you want the captcha image to appear.


Are you working in a table layout?

If you are working in tables then you can copy and paste this markup item into a table cell or place your cursor in the cell you want the captch and then select to insert the markup item, it will then be inserted in the actual cell, this cell would need to be at least 30px high x 130px wide.


^-- Top















Resize the markup item to the same width as fields to allow room for the text and menu, this image shows how the form might look after re-sizing and moving the markup item to it's position.







^-- Top








Step 3: Optional - Add a title field for the easiCaptcha text:






It would help your users to add a little text to the left of where the easiCaptchaM question and answer menu appear, you could just add this as a text such as 'Question:' in an HTML text block and have done with it but here we show you how to add the text so it will appear red if the user makes a mistake with the easiCaptchaM answer, to do this we add another Markup item...

Select: "Insert > Markup Item... " and paste the following code in the markup window as shown in the image to the right.

if ($ef_errors || $captcha_error) {
echo '<font color=red><b>Question: </b></font>';
} else {
echo 'Question:';


^-- Top








Step 4: Check the form 'submit' button values are correct for easiCaptcha:






The Submit button of your form must have the name of 'submit' (Without quotes), it also needs to have a value, this can be any value that suites your form, for example it could be 'Submit', 'Send', 'Proceed' or other but it must not be blank.

Don't forget to add some text to the left of the 'text field' to let the user know the field is for the Captcha text.

Note: easiCaptcha will not function unless these adjustments are made to the button you use for your form submission.



^-- Top








Step 5: The Freeway form notation:






Your form containing easiCaptcha needs to end in '.php' (Without the quotes) For example: if your form is called myform.html it should be changed to myform.php

Note: Once you change the form notation to .php the form will no longer be previewable in Freeway, you will just see the code from the page when selecting the 'Preview' tab, this is normal behaviour.



^-- Top








Step 6: Add a Mark-up item for any user entered captcha text error:








If the user enters the captcha text incorrectly and submits the form we will need to show them an error, to do this we must add another 'Markup Item'.

Select: 'Insert > Markup Item...' and paste the following code in the markup window as shown in the image to the right.

<?php if ($captcha_error) { echo $captcha_error; } ?>

Press 'OK' to close the Markup window and position the 'Markup Item' at the top of your form items, or any other location on the page you want the error alert to be.

^-- Top










Step 7: Upload files to server:






Using an ftp client upload the following easiCaptcha scripts to the same directory as your form:


easiCaptcha_license.php (Not available with demo version and is supplied on purchase)

if you prefer to configure the captcha to your own preferences then open the 'easiCaptchaM_config.php' file with BBEdit or other text editor and alter the variables as directed and save the changes. If you do not want to change any of the configuration then you do not need to open, or even use the configuration file if you don't want to.

Upload the 'ioncube' loaders folder to the server. This can be located in the same directory as your form, or if you are using more than one copy of easiCaptcha or other easiScripts on your server you should place the 'ioncube' folder in the top level directory of your server.






You now need to upload your Freeway form pages to the server, this can be done using Freeway or an ftp client.






This tutorial shows only how to add easiCaptchaM to your Freeway form, we recommend using easiCaptcha or easiCaptchaM with easiForm.

^-- Top






IMPORTANT: (If you are not using easiCaptcha or easiCaptchaM with easiForm)






When processing your form take care to check for any captcha error so that your form is not sent when the user has not entered the correct captcha text. To do this you can check the value of $captcha_error, if it has a value then there was an error with the user entered text.

The value of $captcha_error will depend on how you have set the $captcha_error_c option in the easiCaptchaM_config.php script, if you have set this to 'true' (without quotes) then $captcha_error will return true if there is an error, otherwise a text string will be returned.

An example of PHP code to add to your php script to handle a captcha error could be along the lines of:

// Suggestion - You can check other form values here so the form knows of user value errors.
if ($captcha_error) {
// Captcha filled in wrong.
} else {
// Include your PHP form code to send the form

If using either easiCaptcha or easiCaptchaM with easiForm then easiForm will take care of this for you.









More Freeway 4 Pro examples here.

^-- Top










Copyright © Mike Brackenridge 2006 - 2024 || Freeway is a registered trademark of Softpress Systems Limited.






Note: This page shows installation of the easiCaptchaM math question version, to see the installation of easiCaptcha which is the image version: Select here