The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/showthread.php 26 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/showthread.php 26 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/showthread.php 26 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/showthread.php 137 forum_permissions
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key "mybb" - Line: 1952 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1952 errorHandler->error
/inc/functions_indicators.php 41 my_set_array_cookie
/showthread.php 629 mark_thread_read
Warning [2] Undefined property: MyLanguage::$ratings_update_error - Line: 5 - File: showthread.php(732) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/showthread.php(732) : eval()'d code 5 errorHandler->error
/showthread.php 732 eval
Warning [2] Undefined variable $postsdone - Line: 867 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 867 errorHandler->error
Warning [2] Trying to access array offset on value of type null - Line: 867 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 867 errorHandler->error
Warning [2] Undefined array key 35344 - Line: 867 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 867 errorHandler->error
Warning [2] Undefined array key 35389 - Line: 867 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 867 errorHandler->error
Warning [2] Undefined array key 35390 - Line: 867 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 867 errorHandler->error
Warning [2] Undefined array key 35408 - Line: 867 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 867 errorHandler->error
Warning [2] Undefined array key 35665 - Line: 867 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 867 errorHandler->error
Warning [2] Undefined array key 36719 - Line: 867 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 867 errorHandler->error
Warning [2] Undefined array key 36781 - Line: 867 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 867 errorHandler->error
Warning [2] Undefined array key 39068 - Line: 867 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 867 errorHandler->error
Warning [2] Undefined array key 35344 - Line: 1576 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 1576 errorHandler->error
/showthread.php 1578 buildtree
/showthread.php 879 buildtree
Warning [2] Undefined array key 35389 - Line: 1576 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 1576 errorHandler->error
/showthread.php 1578 buildtree
/showthread.php 879 buildtree
Warning [2] Undefined array key 35390 - Line: 1576 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 1576 errorHandler->error
/showthread.php 1578 buildtree
/showthread.php 879 buildtree
Warning [2] Undefined array key 35408 - Line: 1576 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 1576 errorHandler->error
/showthread.php 1578 buildtree
/showthread.php 879 buildtree
Warning [2] Undefined array key 35665 - Line: 1576 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 1576 errorHandler->error
/showthread.php 1578 buildtree
/showthread.php 879 buildtree
Warning [2] Undefined array key 36719 - Line: 1576 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 1576 errorHandler->error
/showthread.php 1578 buildtree
/showthread.php 879 buildtree
Warning [2] Undefined array key 36781 - Line: 1576 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 1576 errorHandler->error
/showthread.php 1578 buildtree
/showthread.php 879 buildtree
Warning [2] Undefined array key 39068 - Line: 1576 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 1576 errorHandler->error
/showthread.php 1578 buildtree
/showthread.php 879 buildtree
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 880 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 880 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 880 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 880 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 880 build_postbit
Warning [2] Undefined array key "showimages" - Line: 784 - File: inc/functions_post.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions_post.php 784 errorHandler->error
/showthread.php 880 build_postbit
Warning [2] Undefined array key "invisible" - Line: 1506 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/showthread.php 1506 errorHandler->error
Warning [2] Undefined variable $threadnotesbox - Line: 30 - File: showthread.php(1533) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 30 errorHandler->error
/showthread.php 1533 eval
Warning [2] Undefined variable $multipage - Line: 33 - File: showthread.php(1533) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 33 errorHandler->error
/showthread.php 1533 eval
Warning [2] Undefined variable $multipage - Line: 65 - File: showthread.php(1533) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 65 errorHandler->error
/showthread.php 1533 eval
Warning [2] Undefined variable $addremovesubscription - Line: 79 - File: showthread.php(1533) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 79 errorHandler->error
/showthread.php 1533 eval



FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Google Recaptcha
#7
Sad 
Thanks for your post, it seems there aren't many people using FT and Google reCaptcha or else there are but their methodology is a closely guarded secret. Clearly I'm missing something (some brain cells perhaps). I have followed your instructions, to the letter I think. My form.php has, above the <html> tag, from the FT docs:
PHP Code:
<?php
require_once("formtools/global/api/api.php");
ft_api_start_sessions();
$fields = isset($_SESSION["form_tools_form_data"]) ?
 
 ft_strip_tags($_SESSION["form_tools_form_data"]) : array();
?>
The <HEAD> section has, just before the closing </HEAD>:
Code:
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
Form declaration is:
Code:
<form action="http://eagletaxicabs.co.za/formtools/process.php" method="post">
Immediately below that I have:
PHP Code:
<?php ft_api_display_post_form_captcha_error(); ?>
At the bottom of the form, immediately before the submit button I have (data-sitekey obfuscated):
Code:
<div class="g-recaptcha" data-sitekey="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"></div>
The /formtools/global/config.php contains (keys obfuscated):
PHP Code:
// recaptcha keys
$g_api_recaptcha_private_key "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$g_api_recaptcha_public_key "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
I know this is probably pointless but I modified the api.php call in process.php, commented out the include and replaced it with a require as per the FT docs:
PHP Code:
// if the API is supplied, include it as well
$folder dirname(__FILE__);
//@include_once("$folder/global/api/api.php");
require_once("$folder/global/api/api.php"); 
I modified the recaptcha_check_answer function calls in process.php and api.php to:
PHP Code:
$resp recaptcha_check_answer($g_api_recaptcha_private_key$_SERVER["REMOTE_ADDR"], $recaptcha_challenge_field); 
I commented out the original recaptcha_check_answer function in recaptchalib.php and replaced it with:
PHP Code:
function recaptcha_check_answer ($privkey$remoteip$challenge){

if (
$privkey == null || $privkey == '') {
die (
"To use reCAPTCHA you must get an API key from Recaptcha");
}

if 
 ($remoteip == null || $remoteip == '') {
die (
"For security reasons, you must pass the remote ip to reCAPTCHA");
}


 
        //error_log($challenge, 0, "formtools/error_log.txt");
 
      //discard spam submissions
 
      if ($challenge == null || strlen($challenge) == 0) {
 
              $recaptcha_response = new ReCaptchaResponse();
 
              $recaptcha_response->is_valid false;
 
              $recaptcha_response->error 'incorrect-captcha-sol';
 
              return $recaptcha_response;
 
      }
 
              

$url
="https://www.google.com/recaptcha/api/siteverify";
$result file_get_contents($url."?secret=".$privkey."&response=".$challenge."&remoteip=".$remoteip);
//error_log($result, 0, "formtools/error_log.txt");
 
              

       
       
       $recaptcha_response 
= new ReCaptchaResponse();

 
      if ($result['success'] == "true" || $result['success'] == 1  || $result['success'] == TRUE) {
 
              //error_log("true", 0 , "formtools/error_log.txt");
 
              $recaptcha_response->is_valid true;
 
      }
 
      else {
 
              $recaptcha_response->is_valid false;
 
              $recaptcha_response->error $result[1];
 
      }
 
      return $recaptcha_response;


...even kept your comments and formatting.
The form page loads correctly and I see the reCaptcha widget, which behaves as expected. The problem is that if I hit submit without having touched the reCaptcha, I don't get any error and the form is submitted as it would normally be. I don't think I have a PHP compiler/debugger with which to step through the code and troubleshoot. Am I missing something? Any help greatly appreciated. TIA
Time flies like an arrow...fruit flies like a banana
Reply


Messages In This Thread
Google Recaptcha - by whatfield73 - Aug 22nd, 2017, 11:00 AM
RE: Google Recaptcha - by alexh - Aug 22nd, 2017, 12:45 PM
RE: Google Recaptcha - by whatfield73 - Aug 23rd, 2017, 8:29 AM
RE: Google Recaptcha - by whatfield73 - Aug 23rd, 2017, 10:48 AM
RE: Google Recaptcha - by nelsondcosta - Aug 24th, 2017, 12:57 AM
RE: Google Recaptcha - by alexh - Sep 1st, 2017, 7:47 AM
RE: Google Recaptcha - by Crexis - Oct 8th, 2017, 7:10 AM
RE: Google Recaptcha - by whatfield73 - Oct 10th, 2017, 6:14 PM
RE: Google Recaptcha - by HudsonKhull - Dec 27th, 2019, 10:29 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)