The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.27 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.27 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(257) : eval()'d code PHP 8.1.27 (Linux)
File Line Function
/printthread.php(257) : eval()'d code 2 errorHandler->error
/printthread.php 257 eval
/printthread.php 117 printthread_multipage
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.27 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
easy solution for Captcha without the API - Formtools v2.X - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: easy solution for Captcha without the API - Formtools v2.X (/showthread.php?tid=2306)

Pages: 1 2


easy solution for Captcha without the API - Formtools v2.X - Tzvook - Dec 2nd, 2012

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:
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 ..

..


RE: easy solution for Captcha without the API - Formtools v2.X - bills - Dec 19th, 2012

Thanks! I struggled with the API and was unsuccessful. This works great.


RE: easy solution for Captcha without the API - Formtools v2.X - Tzvook - Jan 12th, 2013

:-)
glad to hear ....
If there were no comment, it probably works as expected for all ...


RE: easy solution for Captcha without the API - Formtools v2.X - Joe - Jan 16th, 2013

Awesome! Thanks for sharing with our community!


RE: easy solution for Captcha without the API - Formtools v2.X - moorezilla - Jan 30th, 2013

Thanks for adding this!

Just a note, but I think that this:

ft_display_page("../../global/smarty/messages.tpl", $page_vars);

should be changed to something like

ft_display_page("error.tpl", $page_vars);

I don't think ../../global/smarty/messages.tpl exists... at least I didn't see it on my install.


RE: easy solution for Captcha without the API - Formtools v2.X - seanmcd51 - Mar 11th, 2013

I'm having trouble making it work. For some reason I was able to get through the form setup process fine but now the captcha won't verify the image. Here is my form: http://www.imnotaclown.com/library/

I tried making the changes as moorezilla suggested but that didn't seem to work either.

Suggestions? Thank you.

(Jan 30th, 2013, 10:49 AM)moorezilla Wrote: Thanks for adding this!

Just a note, but I think that this:

ft_display_page("../../global/smarty/messages.tpl", $page_vars);

should be changed to something like

ft_display_page("error.tpl", $page_vars);

I don't think ../../global/smarty/messages.tpl exists... at least I didn't see it on my install.




RE: easy solution for Captcha without the API - Formtools v2.X - RetroWill - May 3rd, 2013

Is there any way to have the error page a custom one of your own?


RE: easy solution for Captcha without the API - Formtools v2.X - leeburstroghm - Jan 21st, 2015

yes, still pretty much correct as of today, BEST solution yet!


RE: easy solution for Captcha without the API - Formtools v2.X - kan - Jan 24th, 2016

Hi,

can someone help me, and explain me where I can set the action on the form?
When I look in the formbuilder/published directory and have a look in the code of my form there is no <form action...>


Your forms need to go to the new file:
something like - <form action="http://www.your-domain.com/formtools/processC.php" method="post">


and also, how can I add the below catcha code to forms built with formbuilder?

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>


thanks in advance,

Kan


RE: easy solution for Captcha without the API - Formtools v2.X - Oldie - Aug 24th, 2016

Hi Kan, did you or anyone else figure out how to get the captcha to work on the form? I try pasting the code but it never works.