I have been using formtools for a few years now.
Since I saw lots of requests for using a Captcha without the API ( tested under Formtools version v2.0.2 , should fit the whole 2.x branch)
I decided to contribute this easy solution to this nice community.
So I dedicated a few minutes to clean the Hebrew from it and turn it into English for you to use ..... with my peace blessings from Israel :-)
First of all go to http://www.phpcaptcha.org/ and download the "Securimage" files.
put the files under the main formtools directory (formtools/securimage/)
open your formtools/process.php , save it under a new name - lets say "processC.php" - it will be used for all your captcha-enabled forms.
NOW edit the file ("processC.php"):
the first line:
should turn into:
around line 100 - AFTER these lines
ADD THE CODE:
==============================================
Your forms need to go to the new file:
something like - <form action="http://www.your-domain.com/formtools/processC.php" method="post">
and the captcha itself, wherever you need it in your form:
There are a lot of nice features @ http://www.phpcaptcha.org/ ... all those can be inserted in your forms ... I simply gave the easiest implementation ...
It's a quick solution - I just made it and didn't had too many tests - but it seems to work perfectly, I'll be glad to hear if you had issues with it ..
..
Since I saw lots of requests for using a Captcha without the API ( tested under Formtools version v2.0.2 , should fit the whole 2.x branch)
I decided to contribute this easy solution to this nice community.
So I dedicated a few minutes to clean the Hebrew from it and turn it into English for you to use ..... with my peace blessings from Israel :-)
First of all go to http://www.phpcaptcha.org/ and download the "Securimage" files.
put the files under the main formtools directory (formtools/securimage/)
open your formtools/process.php , save it under a new name - lets say "processC.php" - it will be used for all your captcha-enabled forms.
NOW edit the file ("processC.php"):
the first line:
Code:
<?php
should turn into:
Code:
<?php
session_start();
around line 100 - AFTER these lines
Code:
// do we have a form for this id?
if (!ft_check_form_exists($form_id))
{
$page_vars = array("message_type" => "error", "message" => $LANG["processing_invalid_form_id"]);
ft_display_page("../../global/smarty/messages.tpl", $page_vars);
exit;
}
ADD THE CODE:
Code:
// Tzvook captcha
$folder = dirname(__FILE__);
@include_once("$folder/securimage/securimage.php");
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
// the code was incorrect
// you should handle the error so that the form processor doesn't continue
// or you can use the following code if there is no validation or you do not know how
$page_vars = array("message_type" => "error", "message" => "<center><div style=\"width: 500px; border: 1px solid #FF0000; background-color: #FFFFFF; padding: 30px; font-family: Tahoma, Arial; font-size: 16px; color: #000000; margin: 0 auto;\">You did not typed the right verification code<br /><br />The verification code is checking to see if you are really humans<br />and not a SPAM automatic robots</strong><br /><br />Please go back and try again<br /><br /><A href=\"javascript:history.back(-1)\" onmouseover='window.status = \"\" ;return true'>Back to the form</a></div></center>");
ft_display_page("../../global/smarty/messages.tpl", $page_vars);
exit;
}
// End Tzvook captcha
Your forms need to go to the new file:
something like - <form action="http://www.your-domain.com/formtools/processC.php" method="post">
and the captcha itself, wherever you need it in your form:
Code:
<img id="captcha" src="http://www.your-domain.com/formtools/securimage/securimage_show.php" alt="CAPTCHA Image" alt="Security Image" style="padding-left: 4px;" align="right" />
<font size="1">copy the code to the field:</font><br />
<input type="text" name="captcha_code" size="10" maxlength="6" />
<a href="#" onclick="document.getElementById('captcha').src = 'http://www.your-domain.com/formtools/securimage/securimage_show.php?' + Math.random(); return false">[ Different Image ]</a>
There are a lot of nice features @ http://www.phpcaptcha.org/ ... all those can be inserted in your forms ... I simply gave the easiest implementation ...
It's a quick solution - I just made it and didn't had too many tests - but it seems to work perfectly, I'll be glad to hear if you had issues with it ..
..