Zen Cart Logo
Forums / All Other Contributions/Addons / Support Thread for Google reCAPTCHA plugin

Support Thread for Google reCAPTCHA plugin

Views: 176,320

Results 441 to 460 of 694
10 Oct 2019, 8:06 PM
#441
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Support Thread for Google reCAPTCHA plugin

Jim, suggested change on latest version: documentation says that if $publickey is missing, it will auto disable. This is not quite so. It will not appear on the form pages but the check will still be done and will fail. To complete this feature, change

classes/observers/class.google_recaptcha.php

in the constructor right before the attach to do:

if (empty($publickey)) $pages_to_check = array(); 

Tested and verified in 1.5.6c.

10 Oct 2019, 11:32 PM
#442
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

swguy:

Jim, suggested change on latest version: documentation says that if $publickey is missing, it will auto disable. This is not quite so. It will not appear on the form pages but the check will still be done and will fail. To complete this feature, change

classes/observers/class.google_recaptcha.php

in the constructor right before the attach to do:

if (empty($publickey)) $pages_to_check = array(); 

Tested and verified in 1.5.6c.

Thanks Scott. I'll be sure this gets into the next release.

16 Oct 2019, 1:56 AM
#443
a02l1zz avatar

a02l1zz

New Zenner

Join Date:
Nov 2009
Posts:
27
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi All,

I am having an issue with Bots I believe creating new accounts on my 1.3.9h system, which has been running just fine now for a while. I read through the entire thread here and didn't see or find anything related to the issue that I am having.

I have followed the instructions, and I believe that I have everything alright, but after loading the files up and modifying them as necessary, when reloading the main store page, I just get a blank page. Checking the logs, I get the following error message:

[15-Oct-2019 19:46:53] PHP Warning: Unexpected character in input: '' (ASCII=92) state=1 in /home1/bnmhobbi/public_html/store/includes/classes/observers/class.google_recaptcha.php on line 31
[15-Oct-2019 19:46:53] PHP Parse error: syntax error, unexpected T_STRING in /home1/bnmhobbi/public_html/store/includes/classes/observers/class.google_recaptcha.php on line 31

I can't for the life of me figure out what is wrong. If I remove all the files I upload, and revert back the files that I update manually, everything starts working again. Anyone got any idea on where to look here.

Also, where should the following be added tot he template files.

<?php echo recaptcha_get_html(); ?>

James

16 Oct 2019, 2:22 AM
#444
a02l1zz avatar

a02l1zz

New Zenner

Join Date:
Nov 2009
Posts:
27
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

a02l1zz:

Hi All,

I am having an issue with Bots I believe creating new accounts on my 1.3.9h system, which has been running just fine now for a while. I read through the entire thread here and didn't see or find anything related to the issue that I am having.

I have followed the instructions, and I believe that I have everything alright, but after loading the files up and modifying them as necessary, when reloading the main store page, I just get a blank page. Checking the logs, I get the following error message:

[15-Oct-2019 19:46:53] PHP Warning: Unexpected character in input: '' (ASCII=92) state=1 in /home1/bnmhobbi/public_html/store/includes/classes/observers/class.google_recaptcha.php on line 31
[15-Oct-2019 19:46:53] PHP Parse error: syntax error, unexpected T_STRING in /home1/bnmhobbi/public_html/store/includes/classes/observers/class.google_recaptcha.php on line 31

I can't for the life of me figure out what is wrong. If I remove all the files I upload, and revert back the files that I update manually, everything starts working again. Anyone got any idea on where to look here.

Also, where should the following be added tot he template files.

<?php echo recaptcha_get_html(); ?>
> 
> James

Hi All,

I was able to find the issue and it seems that I file had uploaded that was Zero Bytes, reloading the file solved the issue, and now the Captcha option is showing up. The issue is that it is showing up in the top left corner of the page, and it malforms the look of the page. How does one include it next to the submit button. Also, once I check the "I am not a robot" option, and then click submit, it prompts me for the Captcha on a blank page, how does one fix this.
16 Oct 2019, 1:24 PM
#445
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Thanks for the update on the fix.

For the placement, <?php echo recaptcha_get_html(); ?> should be inserted into the file where you want the captcha to appear. Typically, this is just before the submit button.

For the blank page, check the 'logs' folder for the error that is occurring.

16 Oct 2019, 6:39 PM
#446
a02l1zz avatar

a02l1zz

New Zenner

Join Date:
Nov 2009
Posts:
27
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

jeking:

Thanks for the update on the fix.

For the placement, <?php echo recaptcha_get_html(); ?> should be inserted into the file where you want the captcha to appear. Typically, this is just before the submit button.

For the blank page, check the 'logs' folder for the error that is occurring.

Hi Jim,

Thanks for the information. I have been looking at the create_account.php file, and the one thing I can't figure out is where the submit button is actually loaded.

Looking into the Code, I only see one line with the word "Submit" in it, as per below, but it's just a message, and not part of the code:

$messageStack->add_session('header', (defined('ERROR_CREATE_ACCOUNT_SPAM_DETECTED') ? ERROR_CREATE_ACCOUNT_SPAM_DETECTED : 'Thank you, your account request has been submitted for review.'), 'success');

So now I think I'm trying to modify the wrong page, but I can't figure out what is presenting the create_account.php layout, when that's called.

James

16 Oct 2019, 7:03 PM
#447
a02l1zz avatar

a02l1zz

New Zenner

Join Date:
Nov 2009
Posts:
27
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

a02l1zz:

Hi Jim,

Thanks for the information. I have been looking at the create_account.php file, and the one thing I can't figure out is where the submit button is actually loaded.

Looking into the Code, I only see one line with the word "Submit" in it, as per below, but it's just a message, and not part of the code:

$messageStack->add_session('header', (defined('ERROR_CREATE_ACCOUNT_SPAM_DETECTED') ? ERROR_CREATE_ACCOUNT_SPAM_DETECTED : 'Thank you, your account request has been submitted for review.'), 'success');

> 
> So now I think I'm trying to modify the wrong page, but I can't figure out what is presenting the create_account.php layout, when that's called.
> 
> James

Jim,

OK, so upon further checking, I figured out the template filename and added the respective <?php echo recaptcha_get_html(); ?> to what I thought was the right location within the file. It however, presents the Captcha box input form twice. I tried in three different locations within the form and it did the same thing. Am I missing something as to what is going on?

James
16 Oct 2019, 7:32 PM
#448
a02l1zz avatar

a02l1zz

New Zenner

Join Date:
Nov 2009
Posts:
27
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

a02l1zz:

Jim,

OK, so upon further checking, I figured out the template filename and added the respective <?php echo recaptcha_get_html(); ?> to what I thought was the right location within the file. It however, presents the Captcha box input form twice. I tried in three different locations within the form and it did the same thing. Am I missing something as to what is going on?

James

Jim,

This is what I am seeing on the Create Account Page:
Attachment 18690

James

16 Oct 2019, 7:38 PM
#449
a02l1zz avatar

a02l1zz

New Zenner

Join Date:
Nov 2009
Posts:
27
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

a02l1zz:

Jim,

This is what I am seeing on the Create Account Page:
Attachment 18690

James

Jim,

I am all set, I have been able to figure out where the issue was and have it down to one Captcha Box. Thanks again.

James

28 Oct 2019, 1:17 PM
#450
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi

I have an issue on my website: We are starting to receive several fake account profiles and on checking the ReCaptcha form on our contact page, message are going through withour this being checked.

Our website Is Zencart 1.5.3 on PHP 5.6 So I tried to install 3.4.1 again and I am still getting the issue.

I have tried this set up in the tpl_contact_us_default.php, tpl_modules_create_account.php and tpl_products_reviews_write_default.php, both:

<?php echo recaptcha_get_html($publickey, $resp->error,$request_type == 'SSL'); ?>

And

<?php echo recaptcha_get_html(); ?>

neither work

Theres no error logs and nothing related in the /logs/ folder

I have also set up a new Recaptcha key for shaftlimited.com and configured this new key and again this makes no difference.

The form can be viewed here https://shaftlimited.com/contact_us.html

We did migrate server about 3 months ago, but only recently has this issue come to light.

includes/modules/pages/contact_us/header_php.php around line 18 reads:

$error = false;
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
  $name = zen_db_prepare_input($_POST['contactname']);
  $email_address = zen_db_prepare_input($_POST['email']);
  $subject = zen_db_prepare_input($_POST['subject']);
  $enquiry = zen_db_prepare_input(strip_tags($_POST['enquiry']));
  $antiSpam = isset($_POST['should_be_empty']) ? zen_db_prepare_input($_POST['should_be_empty']) : '';
  $zco_notifier->notify('NOTIFY_CONTACT_US_CAPTCHA_CHECK');

  $zc_validate_email = zen_validate_email($email_address);


  if ($zc_validate_email and !empty($enquiry) and !empty($name) and !empty($subject) && $error == FALSE) {
    // if anti-spam is not triggered, prepare and send email:
   if ($antiSpam != '') {
      $zco_notifier->notify('NOTIFY_SPAM_DETECTED_USING_CONTACT_US');
   } elseif ($antiSpam == '') {

    // auto complete when logged in
    if($_SESSION['customer_id']) {
      $sql = "SELECT customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id
              FROM " . TABLE_CUSTOMERS . "
              WHERE customers_id = :customersID";

      $sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
      $check_customer = $db->Execute($sql);
      $customer_email= $check_customer->fields['customers_email_address'];
      $customer_name= $check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname'];
    } else {
      $customer_email = NOT_LOGGED_IN_TEXT;
      $customer_name = NOT_LOGGED_IN_TEXT;
    }

Please help or let me know if you need further info from me.

Many thanks in advance.

28 Oct 2019, 1:55 PM
#451
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Your includes/modules/pages/contact_us/header_php.php looks correct. Just be sure the rest of the files in this plugin have been loaded into the correct locations.

While like unrelated, you have a mixed content problem on your site.

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js" type="text/javascript"></script>

is being callled insecurely so is not loading. Fix that and then check the CAPTCHA again.

28 Oct 2019, 4:43 PM
#452
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Thanks jeking

This is part of the template. I commented it out but this has made no difference.

28 Oct 2019, 5:13 PM
#453
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

dharrison:

Thanks jeking

This is part of the template. I commented it out but this has made no difference.

Don't remove if. Edit it to be:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js" type="text/javascript"></script>

https

For your captcha, check over any template override files. I've seen where a template override was an older version or just missing something that belonged in the current version of Zen Cart. In some cases, switching to the default template works but not in this case since template overrides are required.

28 Oct 2019, 6:54 PM
#454
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi Jeking

I changed the script to https and nothing.

As the site is 1.5.3 I checked what I had before (many moons ago when this worked) and checked the files (as it says to add the code manually.

The readme file instructed me to add

<?php echo recaptcha_get_html(); ?>

But comparing the tempalte files in WinMerge I also found

<?php echo recaptcha_get_html(true); ?>
<?php echo recaptcha_get_html(false); ?>

And under the write product reviews this was used:

<?php echo recaptcha_get_html($publickey, $resp->error,$request_type == 'SSL'); ?>

So goodness knows. I thought I had done the right thing but the CAPTCHA is being ignored.

28 Oct 2019, 7:09 PM
#455
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

dharrison:

Hi Jeking

I changed the script to https and nothing.

As the site is 1.5.3 I checked what I had before (many moons ago when this worked) and checked the files (as it says to add the code manually.

The readme file instructed me to add

<?php echo recaptcha_get_html(); ?>
> 
> But comparing the tempalte files in WinMerge I also found
> 
> ```
<?php echo recaptcha_get_html(true); ?>
<?php echo recaptcha_get_html(false); ?>
> 
> And under the write product reviews this was used:
> 
> ```
<?php echo recaptcha_get_html($publickey, $resp->error,$request_type == 'SSL'); ?>

So goodness knows. I thought I had done the right thing but the CAPTCHA is being ignored.

You'll want to check that the versions of those templates in your template override folder are current. Meaning compare them to the default versions for 1.5.3.

29 Oct 2019, 10:18 AM
#456
dharrison avatar

dharrison

Zen Follower

Join Date:
Mar 2009
Location:
Essex, UK
Posts:
448
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi Jim

I went back to basics and copied each file across. That resolved the issue. Thank you so much.

It clearly was updated since I originally installed the website.

Thanks for your help . :D

3 Dec 2019, 1:05 AM
#457
a02l1zz avatar

a02l1zz

New Zenner

Join Date:
Nov 2009
Posts:
27
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

Hi All,

So per Jim's advice, I went ahead and upgraded my Zen Cart 1.3.9h site to Zen Cart 1.5.6c, this went much more smoothly than I expected, and I have been able to get the reCAPTCHA Plugin installed, simply by adding the keys, and uploading the files to the site. Upon checking the store, all was well, the reCAPTCHA box, was showing where it should be.

Anyway, after a few days now, I haven't had any SPAM Create Accounts occur and just figured everything was OK, until a person reached out to me via the Contact us Page, stating that they were having issues creating an account, which is working by the way correctly. I was able to test that.

They're telling me that after filling out all the mandatory fields, and checking the box, and clicking submit, it just cycles back to the create account page. I tried this myself, using a fresh email address, and address details, with all data being accurate and I get the same behavior, cycling back to the Account Creation page. The 73.xxx.xxx.150 is my external IP address.

I checked the logs and I see the following, which I can't imagine is related, but it may be:

[03-Dec-2019 00:04:11 UTC] Request URI: /store/index.php?main_page=create_account, IP address: 73.xxx.xxx.150
#1 include(/store/includes/extra_datafiles/products_quantities_mods.php) called at [/store/includes/init_includes/init_file_db_names.php:80]
#2 require(/store/includes/init_includes/init_file_db_names.php) called at [/store/includes/autoload_func.php:48]
#3 require(/store/includes/autoload_func.php) called at [/store/includes/application_top.php:170]
#4 require(/store/includes/application_top.php) called at [/store/index.php:26]
--> PHP Warning: Use of undefined constant STOCK_SHOW_LIMIT - assumed 'STOCK_SHOW_LIMIT' (this will throw an Error in a future version of PHP) in /store/includes/extra_datafiles/products_quantities_mods.php on line 2.

[03-Dec-2019 00:04:11 UTC] Request URI: /store/index.php?main_page=create_account, IP address: 73.xxx.xxx.150
#1 include(/store/includes/extra_datafiles/products_quantities_mods.php) called at [/store/includes/init_includes/init_file_db_names.php:80]
#2 require(/store/includes/init_includes/init_file_db_names.php) called at [/store/includes/autoload_func.php:48]
#3 require(/store/includes/autoload_func.php) called at [/store/includes/application_top.php:170]
#4 require(/store/includes/application_top.php) called at [/store/index.php:26]
--> PHP Warning: Use of undefined constant STOCK_OFFSET - assumed 'STOCK_OFFSET' (this will throw an Error in a future version of PHP) in /store/includes/extra_datafiles/products_quantities_mods.php on line 3.

[03-Dec-2019 00:04:11 UTC] Request URI: /store/index.php?main_page=create_account, IP address: 73.xxx.xxx.150
#1 include(/store/includes/extra_datafiles/products_quantities_mods.php) called at [/store/includes/init_includes/init_file_db_names.php:80]
#2 require(/store/includes/init_includes/init_file_db_names.php) called at [/store/includes/autoload_func.php:48]
#3 require(/store/includes/autoload_func.php) called at [/store/includes/application_top.php:170]
#4 require(/store/includes/application_top.php) called at [/store/index.php:26]
--> PHP Warning: Use of undefined constant STOCK_TEXT_IN_STOCK - assumed 'STOCK_TEXT_IN_STOCK' (this will throw an Error in a future version of PHP) in /store/includes/extra_datafiles/products_quantities_mods.php on line 4.

[03-Dec-2019 00:04:11 UTC] Request URI: /store/index.php?main_page=create_account, IP address: 73.xxx.xxx.150
#1 include(/store/includes/extra_datafiles/products_quantities_mods.php) called at [/store/includes/init_includes/init_file_db_names.php:80]
#2 require(/store/includes/init_includes/init_file_db_names.php) called at [/store/includes/autoload_func.php:48]
#3 require(/store/includes/autoload_func.php) called at [/store/includes/application_top.php:170]
#4 require(/store/includes/application_top.php) called at [/store/index.php:26]
--> PHP Warning: Use of undefined constant STOCK_TEXT_QUANTITY_IN_STOCK - assumed 'STOCK_TEXT_QUANTITY_IN_STOCK' (this will throw an Error in a future version of PHP) in /store/includes/extra_datafiles/products_quantities_mods.php on line 5.

[03-Dec-2019 00:04:11 UTC] Request URI: /store/index.php?main_page=create_account, IP address: 73.xxx.xxx.150
#1 include(/store/includes/extra_datafiles/products_quantities_mods.php) called at [/store/includes/init_includes/init_file_db_names.php:80]
#2 require(/store/includes/init_includes/init_file_db_names.php) called at [/store/includes/autoload_func.php:48]
#3 require(/store/includes/autoload_func.php) called at [/store/includes/application_top.php:170]
#4 require(/store/includes/application_top.php) called at [/store/index.php:26]
--> PHP Warning: Use of undefined constant STOCK_TEXT_OUT_OF_STOCK - assumed 'STOCK_TEXT_OUT_OF_STOCK' (this will throw an Error in a future version of PHP) in /store/includes/extra_datafiles/products_quantities_mods.php on line 6.

[03-Dec-2019 00:04:12 UTC] Request URI: /store/index.php?main_page=create_account, IP address: 73.xxx.xxx.150
#1 sizeof() called at [/store/includes/modules/sideboxes/more_information.php:33]
#2 require(/store/includes/modules/sideboxes/more_information.php) called at [/store/includes/modules/column_left.php:31]
#3 require(/store/includes/modules/column_left.php) called at [/store/includes/templates/template_default/common/tpl_main_page.php:103]
#4 require(/store/includes/templates/template_default/common/tpl_main_page.php) called at [/store/index.php:97]
--> PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in /store/includes/modules/sideboxes/more_information.php on line 33.

Is this part of my problem or is the issue something else altogether?

James

3 Dec 2019, 1:38 AM
#458
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,769
Plugin Contributions:
20

Re: Support Thread for Google reCAPTCHA plugin

You didn't include a link to your site, but I'll take a wild guess - are you using a TemplateMonster template? Check the create_account page and make sure the reCaptcha field is inside the <form> element and that it's being submitted with the form.

The warnings in your debug logs are totally unrelated, although should be sorted because you'll end up having thousands of logs in no time.

3 Dec 2019, 3:02 AM
#459
a02l1zz avatar

a02l1zz

New Zenner

Join Date:
Nov 2009
Posts:
27
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

balihr:

You didn't include a link to your site, but I'll take a wild guess - are you using a TemplateMonster template? Check the create_account page and make sure the reCaptcha field is inside the <form> element and that it's being submitted with the form.

I am not using any 3rd party templates, just the standard Classic Green Template, with a couple of changes made to the standard files, which have been placed in custom template folder structure to make some slight formatting changes, along with a customization that was built for me as part of the Quantity Discounts Plugin by Scott Wilson.

https://www.bnm-hobbies.com

Regards

James

5 Dec 2019, 12:44 AM
#460
a02l1zz avatar

a02l1zz

New Zenner

Join Date:
Nov 2009
Posts:
27
Plugin Contributions:
0

Re: Support Thread for Google reCAPTCHA plugin

a02l1zz:

I am not using any 3rd party templates, just the standard Classic Green Template, with a couple of changes made to the standard files, which have been placed in custom template folder structure to make some slight formatting changes, along with a customization that was built for me as part of the Quantity Discounts Plugin by Scott Wilson.

https://www.bnm-hobbies.com

Regards

James

OK, I figured out what was going on. It was an earlier discussion in the thread the put me on to this, as I upgraded from 1.3.9h to 1.5.6c, I had an Create_Account.php file in my /store/includes/modules/Custom folder, which wasn't upgraded and was still 1.3.9h, and as such, was missing the line that needed to be added. I renamed the file, copied the standard file there, and it's now working. I just have to figure out if the differences between the 1.3.9h and the 1.5.6c files in relation to customization's, assuming that there were any in the first place.

I believe I placed the file there as I was making changes as it was 1.3.9h, so it may not even be necessary to have this file in my custom folder any longer, and I just confirmed that this is the case.

Thanks for everyone's help.

Regards

James