vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Anti-Spam Options - reCAPTCHA v2 Human Verification (https://vborg.vbsupport.ru/showthread.php?t=315960)

djbaxter 03-13-2018 09:35 PM

Yep. See https://vborg.vbsupport.ru/showpost....&postcount=278

MaiThamDobais 03-20-2018 02:31 PM

how i can make it right to left compatible?
because all of my forum is from right to left
and this repcatcha is the only thing that is on the left

BasilFawlty 03-20-2018 04:14 PM

Quote:

Originally Posted by Domenico (Post 2579677)
On line 14 replace:
Code:

                parent::vB_HumanVerify_Abstract($registry);
with:
Code:

                parent::__construct($registry);
That's it. :)


Woo hoo! I just installed the mod with my new upgrade to VB4.2.5 and had the white page of death. This fixed it. All seems to be working as it should now (so far).

(Marked as installed)

ifmefector 03-21-2018 02:03 PM

Just want to say, I installed this today on version 4.25

I had to do this change

Quote:

Originally Posted by Domenico (Post 2579677)
On line 14 replace:
Code:

                parent::vB_HumanVerify_Abstract($registry);
with:
Code:

                parent::__construct($registry);
That's it. :)

and everything is working fine.

Thank You for a nice mod!

XotelHotel 04-03-2018 12:50 PM

okay with this new recapthca i getting a white screen help me please it all works i tested the connnection and it works fine just showing the white page

Zelda-King 04-05-2018 11:43 AM

Yeah just installed this on 4.2.5. The "test connection" works but if I try to register a new account I get:

Quote:

Call to undefined method vB_HumanVerify_Abstract::vB_HumanVerify_Abstract() on line 14 in /forumpath/class_humanverify_new_recaptcha.php
#0 /forum path/includes/class_humanverify.php(61): vB_HumanVerify_New_Recaptcha->vB_HumanVerify_New_Recaptcha(Object(vB_Registry ))
#1 /forum path/register.php(1244): vB_HumanVerify::fetch_library(Object(vB_Registry))
#2 {main}
The fix posted in post 286 sorted it.

Chrismk 04-11-2018 09:34 AM

Installed successfully into 4.2.5.
Had to apply fix in post 286.

Thank you for providing this - much appreciated!

mightypilot 04-17-2018 01:43 PM

I'm new to vBulletin so bear with me. This recaptcha v2 mod is the first one I've added to my 4.2.5 site. And it worked perfectly. Thank you to those responsible. I'm looking forward to more additions..
--------------
Yesterday: I installed the mod and proclaimed it worked! But I had not tested it yet. When the time came for the new user screen to come up, all I got was a blank white screen. I uninstalled the mod and was going to post a comment about it here, but...

Today: I saw Ifmefector's fix at post #286. I decided to try the fix by first changing the code in the file and then re-uploading the files. This time around the recaptcha worked. Thank you Ifmefector for your post.

It's be interesting to know how the Recaptcha V2 works. If the info was public then hackers would better know a way to get around it maybe?

randytnguyen7 04-18-2018 04:12 PM

Image verification could not be verified due to server issues. Please try again later.

What does it mean?

Stratis 04-19-2018 09:31 AM

Quote:

Originally Posted by randytnguyen7 (Post 2594247)
Image verification could not be verified due to server issues. Please try again later.

What does it mean?

Except the fix above, do you have "curl" option on your server?

randytnguyen7 04-19-2018 06:12 PM

Quote:

Originally Posted by Stratis (Post 2594261)
Except the fix above, do you have "curl" option on your server?

I already fix the curl in php.ini but still showing that message

Stratis 04-20-2018 09:23 AM

Quote:

Originally Posted by randytnguyen7 (Post 2594273)
I already fix the curl in php.ini but still showing that message

Did you see the log file in you server, maybe firewall do not let run the script.?
So you need to exempt that error.

Rawbeen 05-23-2018 10:49 AM

Recaptcha V2 not showing on mobile (IOS)

Hello Everyone !

Quite a Hot topic lately, thanks to kh99 for the good work :)

I just made a fresh install of VB 4.2.5, installed the Recaptacha V2 Mod, Changed the line 14bug and it works well !

Except on mobile phone, for some reason the Recaptcha V2 Widget is not showing.. but if I try to register, I got the warning, "You didn't pass human Verification" so the thing is working, just not showing...

Tried to play around with CSS, but can't get to make it display for
Anyone gets the same issue ? (Safari, or Firefox for iOS tested, same bug, Widget not showing)

http://new.ateliersge.fr/register.php

try it on an actual iPhone to recreate the bug... because when testing on Safari or Firefox the Developper tool "View Adaptive or responsive version" the recaptcha should in the register from...

Rawbeen 05-23-2018 11:32 AM

After a few tests, it seems it could be due to the IOS Version of my iPhone X, currently IOS 11.2.5 causing not to show the widget on mobile...

BUT : it works well on iphone 6 with iOS 11.3 and IOS 11.2.1 and also on iPad IOS 11.4 (beta)

does anyone confirms ?

many thanks

rory2000 06-01-2018 10:52 AM

Hi,

Is it possible to get this MOD updated for 4.2.5 so it works without any changes / and works in the Invisible reCAPTCHA mode as well as the V2 update ?

The Invisible reCAPTCHA will work better at stopping these spammers.

Thanks in advance.

GeneralLife 06-04-2018 02:09 AM

Im getting an error here

Call to undefined method vB_HumanVerify_Abstract::vB_HumanVerify_Abstract() on line 14 in /var/www/vhosts/redacted/redacted/includes/class_humanverify_new_recaptcha.php
#0 /var/www/vhosts/redacted/redacted/includes/class_humanverify.php(61): vB_HumanVerify_New_Recaptcha->vB_HumanVerify_New_Recaptcha(Object(vB_Registry ))
#1 /var/www/vhosts/redacted/redacted/register.php(1244): vB_HumanVerify::fetch_library(Object(vB_Registry))
#2 {main}

djbaxter 06-04-2018 07:09 AM

See https://vborg.vbsupport.ru/showpost....&postcount=217 and https://vborg.vbsupport.ru/showpost.php?p=2586632

EDIT /includes/class_humanverify_new_recaptcha.php

On line 14 replace:

Code:

                parent::vB_HumanVerify_Abstract($registry);
with:

Code:

                parent::__construct($registry);

extremeseo 06-05-2018 02:23 AM

This mod support reCAPTCHA v3 ?

djbaxter 06-05-2018 04:14 AM

No. Hence the title, "reCAPTCHA v2 Human Verification".

Master Of Unive 06-08-2018 07:11 AM

Quote:

Originally Posted by extremeseo (Post 2595033)
This mod support reCAPTCHA v3 ?

Recaptcha v3 is not simply a captcha, it is like a score system for each request so it is more complicated.

Areku 06-29-2018 07:21 AM

I have this installed but I'm still having spammers posting crap as "bots".... I wonder if recaptcha v2 is dead end?

yeahoo 07-07-2018 03:39 PM

Quote:

Originally Posted by Chrismk (Post 2594057)
Installed successfully into 4.2.5.
Had to apply fix in post 286.

Me too ......thanks all !

Areku 07-09-2018 05:34 AM

What does the fix fix?

djbaxter 07-09-2018 07:11 AM

Quote:

Originally Posted by Areku (Post 2595456)
What does the fix fix?

Compatibility with vBulletin 4.2.5 and PHP 7

Areku 07-09-2018 07:16 AM

Quote:

Originally Posted by djbaxter (Post 2595457)
Compatibility with vBulletin 4.2.5 and PHP 7

Yes but am I supposed to see any warning or error message? I'm running 425 and PHP7 but cant remember seeing anything wrong?

djbaxter 07-09-2018 11:10 AM

Anyone trying to register will see error messages. If you are running 4.2.5 and PHP7 and you want to allow new registrations, apply the fix.

This is assuming you are using reCaptcha:

First check at AdminCP >> Settings >> Human Verification Options

Are you using New reCaptcha?

Then check AdminCP >> Settings >> Options >> Human Verification Options

Which boxes are checked there?

If you are using New reCaptcha, then any of the selected options will have problems and throw errors (assuming you haven't turned all errors off - if you have, you may not get an error but you still won't be able to complete those actions.

T.P. 07-26-2018 03:36 AM

class_humanverify_new_recaptcha.php - Fixxed

PHP Code:

<?php

if (!isset($GLOBALS['vbulletin']->db))
{
    exit;
}

require_once(
DIR '/includes/class_vurl.php');

class 
vB_HumanVerify_New_Recaptcha extends vB_HumanVerify_Abstract
{
    public static 
$verify_url 'https://www.google.com/recaptcha/api/siteverify';
    
    
/**
    * Constructor
    *
    * @return    void
    */
    
function __construct(&$registry)
    {
        
parent::__construct($registry);
    }

    private static function 
get_error_phrase($result)
    {
        if (isset(
$result['error-codes']))
            
$errormsg current($result['error-codes']);
        else
            
$errormsg '';
        switch (
$errormsg)
        {
            case 
'missing-input-secret':
            case 
'invalid-input-secret':
                
$error 'humanverify_new_recaptcha_secret';
                break;
            case 
'missing-input-response':
                
$error 'humanverify_new_recaptcha_noanswer';
                break;
            case 
'invalid-input-response':
            default:
                
$error 'humanverify_new_recaptcha_wronganswer';
        }
        return 
$error;
    }


    function 
verify_token($input)
    {
        
$this->registry->input->clean_array_gpc('p', array(
            
'g-recaptcha-response' => TYPE_STR,
        ));

        if (
$this->delete_token($input['hash']) AND isset($this->registry->GPC['g-recaptcha-response']) AND 
                                                    
$this->registry->GPC['g-recaptcha-response'] !== '')
        {    
            
$secret urlencode($this->registry->options['hv_new_recaptcha_privatekey']);
            
$remoteip urlencode(IPADDRESS);
            
$response urlencode($this->registry->GPC['g-recaptcha-response']);

            
$vurl = new vB_vURL($this->registry);
            
$vurl->set_option(VURL_URLself::$verify_url."?secret=$secret&remoteip=$remoteip&response=$response");
            
$vurl->set_option(VURL_USERAGENT'vBulletin ' FILE_VERSION);
            
$vurl->set_option(VURL_RETURNTRANSFER1);
            
$vurl->set_option(VURL_CLOSECONNECTION1);

            if ((
$result $vurl->exec()) === false || ($result json_decode($resulttrue)) === NULL)
            {
                
$this->error 'humanverify_new_recaptcha_unreachable';
                return 
false;
            }
            else
            {
                if (
$result['success'] === true)
                {
                    return 
true;
                }
                
$this->error self::get_error_phrase($result);
                return 
false;
            }
        }
        else
        {
            
$this->error 'humanverify_new_recaptcha_wronganswer';
            return 
false;
        }
    }

    function 
output_token($var_prefix 'humanverify')
    {
        global 
$vbphrase$show;
        
$vbulletin =& $this->registry;

        
$humanverify $this->generate_token();

        
$humanverify['publickey'] = ($this->registry->options['hv_new_recaptcha_publickey'] ? $this->registry->options['hv_new_recaptcha_publickey'] : '');
        
$humanverify['theme'] = $this->registry->options['hv_new_recaptcha_theme'];
        
$humanverify['type'] = $this->registry->options['hv_new_recaptcha_type'];

        if (
preg_match('#^([a-z]{2})-?#i'vB_Template_Runtime::fetchStyleVar('languagecode'), $matches))
        {
            
$humanverify['hl'] = strtolower($matches[1]);
        }
        
        
$templater vB_Template::create('humanverify_new_recaptcha');
            
$templater->register('humanverify'$humanverify);
            
$templater->register('var_prefix'$var_prefix);
        
$output $templater->render();

        return 
$output;
    }

    function 
fetch_answer()
    {
        return 
'';
    }
    
    public static function 
test_check_config()
    {
        global 
$vbulletin;
        
$output = array();
        if (!
is_string($vbulletin->options['hv_new_recaptcha_publickey']) || $vbulletin->options['hv_new_recaptcha_publickey']=='')
            
$output[] = array(1'Site key is not set.');
        else
            
$output[] = array(0'Site key is set: '.$vbulletin->options['hv_new_recaptcha_publickey']);
        if (!
is_string($vbulletin->options['hv_new_recaptcha_privatekey']) || $vbulletin->options['hv_new_recaptcha_privatekey']=='')
            
$output[] = array(1'Secret key is not set.');
        else
            
$output[] = array(0'Secret key is set: '.$vbulletin->options['hv_new_recaptcha_privatekey']);
        if (!
function_exists('curl_init'))
            
$output[] = array(1'cURL must be enabled, and any curl_ functions must be removed from disable_functions in php.ini');
        else 
        {
            
$output[] = array(0'cURL is enabled');
                
$curlinfo curl_version();
           if (empty(
$curlinfo['ssl_version']))
                
$output[] = array(1'cURL does not have ssl enabled');
           else
           {
              
$o = array("cURL version info:");
              foreach (
$curlinfo AS $key=>$value)
              {
                 if (
$key == 'features')
                    
$value '0x'.dechex($value);
                 if (
$key == 'protocols')
                    
$value implode(', ',$value);
                 
$o[] = $key.': '.$value;
              }
              
$output[] = array(0$o);
           }
           if ((
$ch curl_init()) === false)
               
$output[] = array(1'curl_init failed');
           else
                
curl_close($ch);
             if (!
function_exists('curl_exec'))
              
$output[] = array(1'Function curl_exec is disabled. curl_exec must be removed from disable_functions in php.ini.');
           else
                
$output[] = array(0'curl_exec function is not disabled');
        }
    
        return 
$output;
    }

    public static function 
test_display_widget()
    {
        global 
$vbulletin;
        return 
'<script src="https://www.google.com/recaptcha/api.js" async defer></script>
            <div class="g-recaptcha" data-sitekey="'
.$vbulletin->options['hv_new_recaptcha_publickey'].'"></div>';
    }

    public static function 
test_verify()
    {
        global 
$vbulletin$vbphrase;
        
$output = array();
        
        
$vbulletin->input->clean_array_gpc('p', array(
            
'g-recaptcha-response' => TYPE_STR,
        ));
        
        if (!isset(
$vbulletin->GPC['g-recaptcha-response']) || $vbulletin->GPC['g-recaptcha-response'] == '')
            
$output[] = array(1'g-recaptcha-response is not set. Complete the human verification challenge before pressing Submit.');
        else
        {
            
$output[] = array(0'g-recaptcha-response: ' fetch_trimmed_title($vbulletin->GPC['g-recaptcha-response'], 50));
            
$secret urlencode($vbulletin->options['hv_new_recaptcha_privatekey']);
            
$remoteip urlencode(IPADDRESS);
            
$response urlencode($vbulletin->GPC['g-recaptcha-response']);
            
$url self::$verify_url."?secret=$secret&remoteip=$remoteip&response=$response";
            
$output[] = array(0"verify url: '".fetch_trimmed_title($url,160)."'");
            if ((
$ch curl_init()) !== false)
            {
                
curl_setopt($chCURLOPT_URL$url);
                
curl_setopt($chCURLOPT_TIMEOUT15);
                
curl_setopt($chCURLOPT_POST0);
                
curl_setopt($chCURLOPT_HEADER0);
                
curl_setopt($chCURLOPT_HTTPHEADER, array());
                
curl_setopt($chCURLOPT_RETURNTRANSFER1);
                
curl_setopt($chCURLOPT_FOLLOWLOCATION0);
                
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
                
curl_setopt($chCURLOPT_SSL_VERIFYHOST0);

                
$result curl_exec($ch);
                if (
$result === false AND curl_errno($ch) == '60')
                {
                    
$output[] = array(0"Error 60, retrying with CAINFO");
                    
curl_setopt($chCURLOPT_CAINFODIR '/includes/paymentapi/ca-bundle.crt');
                    
$result curl_exec($ch);
                }
                
$info curl_getinfo($ch);
                if (
$result === false)
                   
$output[] = array(1"curl_exec returned false: ".curl_error($ch));
                else
                {
                    if (
$info['http_code'] != 200)
                        
$output[] = array(1"Http response code " $info['http_code']);
                    
$o = array("cURL transfer info:");
                    foreach (
$info AS $key=>$value)
                    {
                        
$o[] = $key.': '.$value;
                    }
                    
$output[] = array($info['http_code'] != 200$o);
                    if (
$info['http_code'] == 200)
                    {
                        
$output[] = array(0"Raw response: ".htmlspecialchars($result));
                        if ((
$result json_decode($resulttrue)) === NULL)
                           
$output[] = array(1"json_decode of response failed");
                        else
                        {
                            
$o = array("Decoded response:");
                            foreach (
$result AS $key=>$value)
                            {
                                if (
$key == 'success')
                                    
$value = ($value 'true' 'false');
                                if (
$key == 'error-codes')
                                    
$value implode(','$value);
                                
$o[] = $key.': '.$value;
                            }
                            
$output[] = array($result['success'] ? 1$o);
                            if (
$result['success'] !== true)
                            {
                                
$error self::get_error_phrase($result);
                                require_once(
DIR.'/includes/functions_misc.php');
                                
$output[] = array(1"Error Phrase: ".fetch_phrase($error'error'));
                            }
                        }
                    }
                    else
                        
$output[] = array(1"Http Response: ".htmlspecialchars($result));
                }
                
curl_close($ch);
            }
            else
                
$output[] = array(1"curl_init() failed.");
        } 
        return 
$output;
    }
}
?>

vBulletin updated the __constructor

aminp30 08-14-2018 03:13 PM

Quote:

Originally Posted by T.P. (Post 2595723)
class_humanverify_new_recaptcha.php - Fixxed

PHP Code:

<?php

if (!isset($GLOBALS['vbulletin']->db))
{
    exit;
}

require_once(
DIR '/includes/class_vurl.php');

class 
vB_HumanVerify_New_Recaptcha extends vB_HumanVerify_Abstract
{
    public static 
$verify_url 'https://www.google.com/recaptcha/api/siteverify';
    
    
/**
    * Constructor
    *
    * @return    void
    */
    
function __construct(&$registry)
    {
        
parent::__construct($registry);
    }

    private static function 
get_error_phrase($result)
    {
        if (isset(
$result['error-codes']))
            
$errormsg current($result['error-codes']);
        else
            
$errormsg '';
        switch (
$errormsg)
        {
            case 
'missing-input-secret':
            case 
'invalid-input-secret':
                
$error 'humanverify_new_recaptcha_secret';
                break;
            case 
'missing-input-response':
                
$error 'humanverify_new_recaptcha_noanswer';
                break;
            case 
'invalid-input-response':
            default:
                
$error 'humanverify_new_recaptcha_wronganswer';
        }
        return 
$error;
    }


    function 
verify_token($input)
    {
        
$this->registry->input->clean_array_gpc('p', array(
            
'g-recaptcha-response' => TYPE_STR,
        ));

        if (
$this->delete_token($input['hash']) AND isset($this->registry->GPC['g-recaptcha-response']) AND 
                                                    
$this->registry->GPC['g-recaptcha-response'] !== '')
        {    
            
$secret urlencode($this->registry->options['hv_new_recaptcha_privatekey']);
            
$remoteip urlencode(IPADDRESS);
            
$response urlencode($this->registry->GPC['g-recaptcha-response']);

            
$vurl = new vB_vURL($this->registry);
            
$vurl->set_option(VURL_URLself::$verify_url."?secret=$secret&remoteip=$remoteip&response=$response");
            
$vurl->set_option(VURL_USERAGENT'vBulletin ' FILE_VERSION);
            
$vurl->set_option(VURL_RETURNTRANSFER1);
            
$vurl->set_option(VURL_CLOSECONNECTION1);

            if ((
$result $vurl->exec()) === false || ($result json_decode($resulttrue)) === NULL)
            {
                
$this->error 'humanverify_new_recaptcha_unreachable';
                return 
false;
            }
            else
            {
                if (
$result['success'] === true)
                {
                    return 
true;
                }
                
$this->error self::get_error_phrase($result);
                return 
false;
            }
        }
        else
        {
            
$this->error 'humanverify_new_recaptcha_wronganswer';
            return 
false;
        }
    }

    function 
output_token($var_prefix 'humanverify')
    {
        global 
$vbphrase$show;
        
$vbulletin =& $this->registry;

        
$humanverify $this->generate_token();

        
$humanverify['publickey'] = ($this->registry->options['hv_new_recaptcha_publickey'] ? $this->registry->options['hv_new_recaptcha_publickey'] : '');
        
$humanverify['theme'] = $this->registry->options['hv_new_recaptcha_theme'];
        
$humanverify['type'] = $this->registry->options['hv_new_recaptcha_type'];

        if (
preg_match('#^([a-z]{2})-?#i'vB_Template_Runtime::fetchStyleVar('languagecode'), $matches))
        {
            
$humanverify['hl'] = strtolower($matches[1]);
        }
        
        
$templater vB_Template::create('humanverify_new_recaptcha');
            
$templater->register('humanverify'$humanverify);
            
$templater->register('var_prefix'$var_prefix);
        
$output $templater->render();

        return 
$output;
    }

    function 
fetch_answer()
    {
        return 
'';
    }
    
    public static function 
test_check_config()
    {
        global 
$vbulletin;
        
$output = array();
        if (!
is_string($vbulletin->options['hv_new_recaptcha_publickey']) || $vbulletin->options['hv_new_recaptcha_publickey']=='')
            
$output[] = array(1'Site key is not set.');
        else
            
$output[] = array(0'Site key is set: '.$vbulletin->options['hv_new_recaptcha_publickey']);
        if (!
is_string($vbulletin->options['hv_new_recaptcha_privatekey']) || $vbulletin->options['hv_new_recaptcha_privatekey']=='')
            
$output[] = array(1'Secret key is not set.');
        else
            
$output[] = array(0'Secret key is set: '.$vbulletin->options['hv_new_recaptcha_privatekey']);
        if (!
function_exists('curl_init'))
            
$output[] = array(1'cURL must be enabled, and any curl_ functions must be removed from disable_functions in php.ini');
        else 
        {
            
$output[] = array(0'cURL is enabled');
                
$curlinfo curl_version();
           if (empty(
$curlinfo['ssl_version']))
                
$output[] = array(1'cURL does not have ssl enabled');
           else
           {
              
$o = array("cURL version info:");
              foreach (
$curlinfo AS $key=>$value)
              {
                 if (
$key == 'features')
                    
$value '0x'.dechex($value);
                 if (
$key == 'protocols')
                    
$value implode(', ',$value);
                 
$o[] = $key.': '.$value;
              }
              
$output[] = array(0$o);
           }
           if ((
$ch curl_init()) === false)
               
$output[] = array(1'curl_init failed');
           else
                
curl_close($ch);
             if (!
function_exists('curl_exec'))
              
$output[] = array(1'Function curl_exec is disabled. curl_exec must be removed from disable_functions in php.ini.');
           else
                
$output[] = array(0'curl_exec function is not disabled');
        }
    
        return 
$output;
    }

    public static function 
test_display_widget()
    {
        global 
$vbulletin;
        return 
'<script src="https://www.google.com/recaptcha/api.js" async defer></script>
            <div class="g-recaptcha" data-sitekey="'
.$vbulletin->options['hv_new_recaptcha_publickey'].'"></div>';
    }

    public static function 
test_verify()
    {
        global 
$vbulletin$vbphrase;
        
$output = array();
        
        
$vbulletin->input->clean_array_gpc('p', array(
            
'g-recaptcha-response' => TYPE_STR,
        ));
        
        if (!isset(
$vbulletin->GPC['g-recaptcha-response']) || $vbulletin->GPC['g-recaptcha-response'] == '')
            
$output[] = array(1'g-recaptcha-response is not set. Complete the human verification challenge before pressing Submit.');
        else
        {
            
$output[] = array(0'g-recaptcha-response: ' fetch_trimmed_title($vbulletin->GPC['g-recaptcha-response'], 50));
            
$secret urlencode($vbulletin->options['hv_new_recaptcha_privatekey']);
            
$remoteip urlencode(IPADDRESS);
            
$response urlencode($vbulletin->GPC['g-recaptcha-response']);
            
$url self::$verify_url."?secret=$secret&remoteip=$remoteip&response=$response";
            
$output[] = array(0"verify url: '".fetch_trimmed_title($url,160)."'");
            if ((
$ch curl_init()) !== false)
            {
                
curl_setopt($chCURLOPT_URL$url);
                
curl_setopt($chCURLOPT_TIMEOUT15);
                
curl_setopt($chCURLOPT_POST0);
                
curl_setopt($chCURLOPT_HEADER0);
                
curl_setopt($chCURLOPT_HTTPHEADER, array());
                
curl_setopt($chCURLOPT_RETURNTRANSFER1);
                
curl_setopt($chCURLOPT_FOLLOWLOCATION0);
                
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
                
curl_setopt($chCURLOPT_SSL_VERIFYHOST0);

                
$result curl_exec($ch);
                if (
$result === false AND curl_errno($ch) == '60')
                {
                    
$output[] = array(0"Error 60, retrying with CAINFO");
                    
curl_setopt($chCURLOPT_CAINFODIR '/includes/paymentapi/ca-bundle.crt');
                    
$result curl_exec($ch);
                }
                
$info curl_getinfo($ch);
                if (
$result === false)
                   
$output[] = array(1"curl_exec returned false: ".curl_error($ch));
                else
                {
                    if (
$info['http_code'] != 200)
                        
$output[] = array(1"Http response code " $info['http_code']);
                    
$o = array("cURL transfer info:");
                    foreach (
$info AS $key=>$value)
                    {
                        
$o[] = $key.': '.$value;
                    }
                    
$output[] = array($info['http_code'] != 200$o);
                    if (
$info['http_code'] == 200)
                    {
                        
$output[] = array(0"Raw response: ".htmlspecialchars($result));
                        if ((
$result json_decode($resulttrue)) === NULL)
                           
$output[] = array(1"json_decode of response failed");
                        else
                        {
                            
$o = array("Decoded response:");
                            foreach (
$result AS $key=>$value)
                            {
                                if (
$key == 'success')
                                    
$value = ($value 'true' 'false');
                                if (
$key == 'error-codes')
                                    
$value implode(','$value);
                                
$o[] = $key.': '.$value;
                            }
                            
$output[] = array($result['success'] ? 1$o);
                            if (
$result['success'] !== true)
                            {
                                
$error self::get_error_phrase($result);
                                require_once(
DIR.'/includes/functions_misc.php');
                                
$output[] = array(1"Error Phrase: ".fetch_phrase($error'error'));
                            }
                        }
                    }
                    else
                        
$output[] = array(1"Http Response: ".htmlspecialchars($result));
                }
                
curl_close($ch);
            }
            else
                
$output[] = array(1"curl_init() failed.");
        } 
        return 
$output;
    }
}
?>

vBulletin updated the __constructor

thank you.I had issue on line 8. your code fixed it :up:

JakeyBoyo 08-16-2018 08:20 PM

When pressing register getting the follow error

Code:

Call to undefined method vB_HumanVerify_Abstract::vB_HumanVerify_Abstract() on line 14 in /home/uniquega/public_html/forum/includes/class_humanverify_new_recaptcha.php
#0 /home/uniquega/public_html/forum/includes/class_humanverify.php(61): vB_HumanVerify_New_Recaptcha->vB_HumanVerify_New_Recaptcha(Object(vB_Registry))
#1 /home/uniquega/public_html/forum/register.php(1244): vB_HumanVerify::fetch_library(Object(vB_Registry))
#2 {main}

Any help appreciated

Master Of Unive 08-17-2018 02:19 AM

Quote:

Originally Posted by JakeyBoyo (Post 2596006)
When pressing register getting the follow error

Code:

Call to undefined method vB_HumanVerify_Abstract::vB_HumanVerify_Abstract() on line 14 in /home/uniquega/public_html/forum/includes/class_humanverify_new_recaptcha.php
#0 /home/uniquega/public_html/forum/includes/class_humanverify.php(61): vB_HumanVerify_New_Recaptcha->vB_HumanVerify_New_Recaptcha(Object(vB_Registry))
#1 /home/uniquega/public_html/forum/register.php(1244): vB_HumanVerify::fetch_library(Object(vB_Registry))
#2 {main}

Any help appreciated

Fixes are in posts above.

rodriiverduguez 08-30-2018 03:39 AM

Quote:

Originally Posted by T.P. (Post 2595723)
class_humanverify_new_recaptcha.php - Fixxed

PHP Code:

<?php

if (!isset($GLOBALS['vbulletin']->db))
{
    exit;
}

require_once(
DIR '/includes/class_vurl.php');

class 
vB_HumanVerify_New_Recaptcha extends vB_HumanVerify_Abstract
{
    public static 
$verify_url 'https://www.google.com/recaptcha/api/siteverify';
    
    
/**
    * Constructor
    *
    * @return    void
    */
    
function __construct(&$registry)
    {
        
parent::__construct($registry);
    }

    private static function 
get_error_phrase($result)
    {
        if (isset(
$result['error-codes']))
            
$errormsg current($result['error-codes']);
        else
            
$errormsg '';
        switch (
$errormsg)
        {
            case 
'missing-input-secret':
            case 
'invalid-input-secret':
                
$error 'humanverify_new_recaptcha_secret';
                break;
            case 
'missing-input-response':
                
$error 'humanverify_new_recaptcha_noanswer';
                break;
            case 
'invalid-input-response':
            default:
                
$error 'humanverify_new_recaptcha_wronganswer';
        }
        return 
$error;
    }


    function 
verify_token($input)
    {
        
$this->registry->input->clean_array_gpc('p', array(
            
'g-recaptcha-response' => TYPE_STR,
        ));

        if (
$this->delete_token($input['hash']) AND isset($this->registry->GPC['g-recaptcha-response']) AND 
                                                    
$this->registry->GPC['g-recaptcha-response'] !== '')
        {    
            
$secret urlencode($this->registry->options['hv_new_recaptcha_privatekey']);
            
$remoteip urlencode(IPADDRESS);
            
$response urlencode($this->registry->GPC['g-recaptcha-response']);

            
$vurl = new vB_vURL($this->registry);
            
$vurl->set_option(VURL_URLself::$verify_url."?secret=$secret&remoteip=$remoteip&response=$response");
            
$vurl->set_option(VURL_USERAGENT'vBulletin ' FILE_VERSION);
            
$vurl->set_option(VURL_RETURNTRANSFER1);
            
$vurl->set_option(VURL_CLOSECONNECTION1);

            if ((
$result $vurl->exec()) === false || ($result json_decode($resulttrue)) === NULL)
            {
                
$this->error 'humanverify_new_recaptcha_unreachable';
                return 
false;
            }
            else
            {
                if (
$result['success'] === true)
                {
                    return 
true;
                }
                
$this->error self::get_error_phrase($result);
                return 
false;
            }
        }
        else
        {
            
$this->error 'humanverify_new_recaptcha_wronganswer';
            return 
false;
        }
    }

    function 
output_token($var_prefix 'humanverify')
    {
        global 
$vbphrase$show;
        
$vbulletin =& $this->registry;

        
$humanverify $this->generate_token();

        
$humanverify['publickey'] = ($this->registry->options['hv_new_recaptcha_publickey'] ? $this->registry->options['hv_new_recaptcha_publickey'] : '');
        
$humanverify['theme'] = $this->registry->options['hv_new_recaptcha_theme'];
        
$humanverify['type'] = $this->registry->options['hv_new_recaptcha_type'];

        if (
preg_match('#^([a-z]{2})-?#i'vB_Template_Runtime::fetchStyleVar('languagecode'), $matches))
        {
            
$humanverify['hl'] = strtolower($matches[1]);
        }
        
        
$templater vB_Template::create('humanverify_new_recaptcha');
            
$templater->register('humanverify'$humanverify);
            
$templater->register('var_prefix'$var_prefix);
        
$output $templater->render();

        return 
$output;
    }

    function 
fetch_answer()
    {
        return 
'';
    }
    
    public static function 
test_check_config()
    {
        global 
$vbulletin;
        
$output = array();
        if (!
is_string($vbulletin->options['hv_new_recaptcha_publickey']) || $vbulletin->options['hv_new_recaptcha_publickey']=='')
            
$output[] = array(1'Site key is not set.');
        else
            
$output[] = array(0'Site key is set: '.$vbulletin->options['hv_new_recaptcha_publickey']);
        if (!
is_string($vbulletin->options['hv_new_recaptcha_privatekey']) || $vbulletin->options['hv_new_recaptcha_privatekey']=='')
            
$output[] = array(1'Secret key is not set.');
        else
            
$output[] = array(0'Secret key is set: '.$vbulletin->options['hv_new_recaptcha_privatekey']);
        if (!
function_exists('curl_init'))
            
$output[] = array(1'cURL must be enabled, and any curl_ functions must be removed from disable_functions in php.ini');
        else 
        {
            
$output[] = array(0'cURL is enabled');
                
$curlinfo curl_version();
           if (empty(
$curlinfo['ssl_version']))
                
$output[] = array(1'cURL does not have ssl enabled');
           else
           {
              
$o = array("cURL version info:");
              foreach (
$curlinfo AS $key=>$value)
              {
                 if (
$key == 'features')
                    
$value '0x'.dechex($value);
                 if (
$key == 'protocols')
                    
$value implode(', ',$value);
                 
$o[] = $key.': '.$value;
              }
              
$output[] = array(0$o);
           }
           if ((
$ch curl_init()) === false)
               
$output[] = array(1'curl_init failed');
           else
                
curl_close($ch);
             if (!
function_exists('curl_exec'))
              
$output[] = array(1'Function curl_exec is disabled. curl_exec must be removed from disable_functions in php.ini.');
           else
                
$output[] = array(0'curl_exec function is not disabled');
        }
    
        return 
$output;
    }

    public static function 
test_display_widget()
    {
        global 
$vbulletin;
        return 
'<script src="https://www.google.com/recaptcha/api.js" async defer></script>
            <div class="g-recaptcha" data-sitekey="'
.$vbulletin->options['hv_new_recaptcha_publickey'].'"></div>';
    }

    public static function 
test_verify()
    {
        global 
$vbulletin$vbphrase;
        
$output = array();
        
        
$vbulletin->input->clean_array_gpc('p', array(
            
'g-recaptcha-response' => TYPE_STR,
        ));
        
        if (!isset(
$vbulletin->GPC['g-recaptcha-response']) || $vbulletin->GPC['g-recaptcha-response'] == '')
            
$output[] = array(1'g-recaptcha-response is not set. Complete the human verification challenge before pressing Submit.');
        else
        {
            
$output[] = array(0'g-recaptcha-response: ' fetch_trimmed_title($vbulletin->GPC['g-recaptcha-response'], 50));
            
$secret urlencode($vbulletin->options['hv_new_recaptcha_privatekey']);
            
$remoteip urlencode(IPADDRESS);
            
$response urlencode($vbulletin->GPC['g-recaptcha-response']);
            
$url self::$verify_url."?secret=$secret&remoteip=$remoteip&response=$response";
            
$output[] = array(0"verify url: '".fetch_trimmed_title($url,160)."'");
            if ((
$ch curl_init()) !== false)
            {
                
curl_setopt($chCURLOPT_URL$url);
                
curl_setopt($chCURLOPT_TIMEOUT15);
                
curl_setopt($chCURLOPT_POST0);
                
curl_setopt($chCURLOPT_HEADER0);
                
curl_setopt($chCURLOPT_HTTPHEADER, array());
                
curl_setopt($chCURLOPT_RETURNTRANSFER1);
                
curl_setopt($chCURLOPT_FOLLOWLOCATION0);
                
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
                
curl_setopt($chCURLOPT_SSL_VERIFYHOST0);

                
$result curl_exec($ch);
                if (
$result === false AND curl_errno($ch) == '60')
                {
                    
$output[] = array(0"Error 60, retrying with CAINFO");
                    
curl_setopt($chCURLOPT_CAINFODIR '/includes/paymentapi/ca-bundle.crt');
                    
$result curl_exec($ch);
                }
                
$info curl_getinfo($ch);
                if (
$result === false)
                   
$output[] = array(1"curl_exec returned false: ".curl_error($ch));
                else
                {
                    if (
$info['http_code'] != 200)
                        
$output[] = array(1"Http response code " $info['http_code']);
                    
$o = array("cURL transfer info:");
                    foreach (
$info AS $key=>$value)
                    {
                        
$o[] = $key.': '.$value;
                    }
                    
$output[] = array($info['http_code'] != 200$o);
                    if (
$info['http_code'] == 200)
                    {
                        
$output[] = array(0"Raw response: ".htmlspecialchars($result));
                        if ((
$result json_decode($resulttrue)) === NULL)
                           
$output[] = array(1"json_decode of response failed");
                        else
                        {
                            
$o = array("Decoded response:");
                            foreach (
$result AS $key=>$value)
                            {
                                if (
$key == 'success')
                                    
$value = ($value 'true' 'false');
                                if (
$key == 'error-codes')
                                    
$value implode(','$value);
                                
$o[] = $key.': '.$value;
                            }
                            
$output[] = array($result['success'] ? 1$o);
                            if (
$result['success'] !== true)
                            {
                                
$error self::get_error_phrase($result);
                                require_once(
DIR.'/includes/functions_misc.php');
                                
$output[] = array(1"Error Phrase: ".fetch_phrase($error'error'));
                            }
                        }
                    }
                    else
                        
$output[] = array(1"Http Response: ".htmlspecialchars($result));
                }
                
curl_close($ch);
            }
            else
                
$output[] = array(1"curl_init() failed.");
        } 
        return 
$output;
    }
}
?>

vBulletin updated the __constructor


Years ago I wanted to add it to my forum but I missed the registry error. Looking again I find your comment, I make the modification and ready. Problem solved, thank you very much. Plugin running in 4.2.5

translated by Google

SuperTaz 09-12-2018 07:06 AM

When trying to add a new member they get this message using the fix a few posts above:

Code:


vBulletin Message
Unable to add cookies, header already sent.
File: /home2/public_html/forums/includes/class_humanverify_new_recaptcha.php
Line: 1
Global Gamers Forums

Any help on this? :confused:

TheBang 09-12-2018 06:34 PM

1 Attachment(s)
So, I already did this for the vB3 version of this plugin several months ago. I had need to do a vB4 install too now, so I've done it for this one too:

I've repackaged this add-on into a 1.0.1 version, which you can download below. The main change is incorporating the required PHP fix (from above). So, this will work properly with vBulletin 4.2.5 and PHP 5.6/7.0/7.1. It should also work with earlier versions, though the minimum PHP version required is probably something like PHP 5.3.

I also updated all the UI elements to refer to the feature as "reCAPTCHA v2" instead of "New reCAPTCHA". I also updated the readme docs, correcting errors and typos.

doopz 09-28-2018 12:49 PM

Quote:

Originally Posted by TheBang (Post 2596348)
So, I already did this for the vB3 version of this plugin several months ago. I had need to do a vB4 install too now, so I've done it for this one too:

I've repackaged this add-on into a 1.0.1 version, which you can download below. The main change is incorporating the required PHP fix (from above). So, this will work properly with vBulletin 4.2.5 and PHP 5.6/7.0/7.1. It should also work with earlier versions, though the minimum PHP version required is probably something like PHP 5.3.

I also updated all the UI elements to refer to the feature as "reCAPTCHA v2" instead of "New reCAPTCHA". I also updated the readme docs, correcting errors and typos.

Thank you! installed in 5 min and works flawlessly.

Sean James 10-05-2018 01:33 AM

When I try and upload the product XML file I am getting this error:

Access Denied - Sucuri Website Firewall
Block reason: An attempted XSS (Cross site scripting) was detected and blocked.

NeoDio 10-05-2018 05:13 AM

vBulletin Message
Unable to add cookies, header already sent.
File: /home2/public_html/forums/includes/class_humanverify_new_recaptcha.php

I also get this message when new users register. Anyone know the fix for that?

Sean James 10-05-2018 05:20 AM

Quote:

Originally Posted by Sean James (Post 2596630)
When I try and upload the product XML file I am getting this error:

Access Denied - Sucuri Website Firewall
Block reason: An attempted XSS (Cross site scripting) was detected and blocked.

All good problem fixed, was a server problem

wawro 10-16-2018 08:31 PM

It works fine on vb 4.2.3

No modification templates required.

Thanks a lot.

All The Best !

rekha 10-17-2018 06:53 AM

i m not able to set this on my forum pls help

TheLastSuperman 10-18-2018 08:52 PM

Quote:

Originally Posted by rekha (Post 2596836)
i m not able to set this on my forum pls help

Make sure you've uploaded the file in the .zip which is class_humanverify_new_recaptcha.php

From there it's > AdminCP > Settings > Human Verification Manager > Set to ReCaptcha v2.

*Note the site key and secret site key i.e. copy them to notepad before changing to v2 and saving, if you do not copy them then when you save the recaptcha type as v2 it will redo the fields and they'll be empty and you'll lose the values (so if you copy now you won't need to login to google to get the keys again you can just copy/paste from notepad).

So that means it's three steps:
1) Upload the one required file.
2) Change the ReCaptcha to v2 in Human Verification Manager
3) Re-enter site key and secret site key in settings and save again.

Modification will be enabled after that.


All times are GMT. The time now is 05:56 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02359 seconds
  • Memory Usage 2,295KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (3)bbcode_php_printable
  • (16)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete