Zen Cart Logo
Forums / All Other Contributions/Addons / Adding reCAPTCHA to Contact Us Form

Adding reCAPTCHA to Contact Us Form

Views: 38,811

Results 41 to 60 of 186
13 Dec 2009, 11:45 PM
#41
baddog1369 avatar

baddog1369

New Zenner

Join Date:
Oct 2009
Location:
Columbus, Ohio
Posts:
38
Plugin Contributions:
0

Adding reCAPTCHA to Contact Us Form

spid3r1987:

never mind, followed some instructions, and it worked :D

What did you miss the first time? I've tried installing this twice and still do not see it in configure. It is a pretty simple install, so I'm at a loss as to why it is not working for me. FWIW, I did notice that two files get modified, not just one (the header and tpl files).

30 Dec 2009, 1:52 PM
#42
davemehta avatar

davemehta

Zen Follower

Join Date:
Aug 2005
Posts:
130
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

I installed the mod and it didn't run the SQL automatically upon logging into my admin page! I don't get a reCaptcha configuration option under the "Configuration" drop-down. Now I have a custom admin folder (not called admin) and so I renamed the admin folder in the package to my name so it uploaded to the right place. It only edits one file in the admin folder anyway, admin/includes/functions/extra_functions/recaptcha_functions.php.

How can I get this to install?

30 Dec 2009, 11:59 PM
#43
davemehta avatar

davemehta

Zen Follower

Join Date:
Aug 2005
Posts:
130
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

So I don't know why it won't "auto-install" when it says it will. I get no option for this! I'm running the latest Zen build (with the security patch).

I see an SQL statement in the admin/includes/functions/extra_functions/recaptcha_functions.php file. Can someone tell me how to get that to work or why this just isn't auto-installing?

31 Dec 2009, 7:43 AM
#44
tomarriola avatar

tomarriola

Zen Follower

Join Date:
Oct 2004
Posts:
206
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

The sql files aren't installing for me. I did see a lot of extra lines in the files downloaded-- could linefeeds be an issue?
Tom

31 Dec 2009, 2:45 PM
#45
davemehta avatar

davemehta

Zen Follower

Join Date:
Aug 2005
Posts:
130
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

The files downloaded look fine -- I think this software is broken, but it's weird because it says it's for v1.3.8? Apparently this has to be the case because the last few people posted they had the same issues. Why won't it auto-install? Is there a way to fix this... anyone? :-)

31 Dec 2009, 8:22 PM
#46
baddog1369 avatar

baddog1369

New Zenner

Join Date:
Oct 2009
Location:
Columbus, Ohio
Posts:
38
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

I think that if I really wanted to install this I'd figure out how to run the SQL statement in the database rather than trying to get it to auto-install.

31 Dec 2009, 9:22 PM
#47
davemehta avatar

davemehta

Zen Follower

Join Date:
Aug 2005
Posts:
130
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

I agree, but the SQL statement relies on variables that I don't know so I can't recreate the SQL statement to run it! I don't know why the author didn't just put it in seperate -- would have saved a lot of headaches!

In the file admin/includes/functions/extra_functions/recaptcha_functions.php we have this function:

function install_recaptcha() {
	global $db;
	$db->Execute("INSERT INTO " . TABLE_CONFIGURATION_GROUP . " VALUES ('', 'reCAPTCHA', 'Config options for reCAPTCHA text', '1', '1')");
	$group_id = mysql_insert_id();
	$db->Execute("UPDATE " . TABLE_CONFIGURATION_GROUP . " SET sort_order = " . $group_id . " WHERE configuration_group_id = " . $group_id);
	$db->Execute("INSERT INTO " . TABLE_CONFIGURATION . " VALUES 
		('', 'Enable Contact Form', 'CONTACT_US_RECAPTCHA_STATUS', 'true', 'Disply reCAPTCHA text on contact form (default: true)', " . $group_id . ", '9', NULL, now(), NULL, 'zen_cfg_select_option(array(\"true\", \"false\"),'),
		('', 'reCAPTCHA Public Key', 'CONTACT_US_RECAPTCHA_PUBLIC_KEY', '', 'Public key given from reCAPTCHA website (default: blank).', " . $group_id . ", '0', NULL, now(), NULL, NULL),
		('', 'reCAPTCHA Private Key', 'CONTACT_US_RECAPTCHA_PRIVATE_KEY', '', 'Private key given from reCAPTCHA website (default: blank).', " . $group_id . ", '0', NULL, now(), NULL, NULL),
		('', 'reCAPTCHA Theme', 'CONTACT_US_RECAPTCHA_THEME', 'white', 'Choose a theme option for the widget.', " . $group_id . ", '1', NULL, now(), NULL, 'zen_cfg_select_option(array(\"red\", \"white\", \"blackglass\", \"clean\"),')		
		");
}

So looking at the code I assume TABLE_CONFIGURATION_GROUP is a define for the zen_configuration_group table in the database. Also I would assume that TABLE_CONFIGURATION is the zen_configuration table.
With those assumptions, someone please tell me if this SQL looks right before I screw something up:

INSERT INTO 'zen_configuration_group' VALUES ('', 'reCAPTCHA', 'Config options for reCAPTCHA text', '1', '1');
UPDATE 'zen_configuration_group' SET sort_order = '$group_id' WHERE configuration_group_id = '$group_id';
INSERT INTO 'zen_configuration' VALUES
('', 'Enable Contact Form', 'CONTACT_US_RECAPTCHA_STATUS', 'true', 'Disply reCAPTCHA text on contact form (default: true)', $group_id, '9', NULL, now(), NULL, 'zen_cfg_select_option(array(\"true\", \"false\"),'),
('', 'reCAPTCHA Public Key', 'CONTACT_US_RECAPTCHA_PUBLIC_KEY', '', 'Public key given from reCAPTCHA website (default: blank).', $group_id, '0', NULL, now(), NULL, NULL),
('', 'reCAPTCHA Private Key', 'CONTACT_US_RECAPTCHA_PRIVATE_KEY', '', 'Private key given from reCAPTCHA website (default: blank).', $group_id, '0', NULL, now(), NULL, NULL),
('', 'reCAPTCHA Theme', 'CONTACT_US_RECAPTCHA_THEME', 'white', 'Choose a theme option for the widget.', $group_id, '1', NULL, now(), NULL, 'zen_cfg_select_option(array(\"red\", \"white\", \"blackglass\", \"clean\"),')

Things I must figure out in above code:

  1. The $group_id variable is just the next available sort order, which is pulled from the SQL command mysql_insert_id()... how do I represent it in the SQL code properly? It's used in several places and I need to know how to write that properly in SQL.

  2. In the last INSERT statement, we have one of the fields as the following: 'zen_cfg_select_option(array("red", "white", "blackglass", "clean"),' -- MY QUESTION: Do I need to use the escape \ there or do I use double-single quotes to make it the right SQL syntax? Also, what about that loan ( before array, do I need to escape that so SQL doesn't think it has to do with my query string (it's just a part of what needs to be written in that field)?

  3. In the last INSERT statement, I assume the use of the SQL function now() is indeed correct, right?

Thanks in advance for the help! Hopefully one of you SQL-gurus can let me know what to do to get this all fixed right so I can run it, and hence get this reCaptcha thng to install and work!

1 Jan 2010, 7:30 PM
#48
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Re: Adding reCAPTCHA to Contact Us Form

davemehta:

Things I must figure out in above code:

  1. The $group_id variable is just the next available sort order, which is pulled from the SQL command mysql_insert_id()... how do I represent it in the SQL code properly? It's used in several places and I need to know how to write that properly in SQL.

  2. In the last INSERT statement, we have one of the fields as the following: 'zen_cfg_select_option(array("red", "white", "blackglass", "clean"),' -- MY QUESTION: Do I need to use the escape \ there or do I use double-single quotes to make it the right SQL syntax? Also, what about that loan ( before array, do I need to escape that so SQL doesn't think it has to do with my query string (it's just a part of what needs to be written in that field)?

  3. In the last INSERT statement, I assume the use of the SQL function now() is indeed correct, right?

Group ID is auto assigned when first created only, then is used for each configuration assigned to that group.

''clean'' is correct for sql.

now() is the sql date/time setting and is correct.

To understand the insert better, configuration database has 11 slots, each one needs something inserted into it.
(configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function)

Some of these fields are required and others may or may not be used, but need something, thus NULL.

In sort... sql statements are not to hard to do once you look at the table... But, one slip of a key and you can wipe out your database.... so BACK IT UP before doing anything!!!

The following is what you was asking for, please understand, this may work for you or not! This is not part of a mod, but just answering a question. **Use at your own rest!!!
**

INSERT INTO configuration_group VALUES ('', 'reCAPTCHA', 'Config options for reCAPTCHA text', '1', '1');
UPDATE configuration_group SET sort_order = last_insert_id() WHERE configuration_group_id = last_insert_id();
SET @t4=0;
SELECT (@t4:=configuration_group_id) as t4 
FROM configuration_group
WHERE configuration_group_title= 'reCAPTCHA';
INSERT INTO configuration VALUES 
('', 'Enable Contact Form', 'CONTACT_US_RECAPTCHA_STATUS', 'true', 'Disply reCAPTCHA text on contact form (default: true)', @t4, '1', now(), now(), NULL, 'zen_cfg_select_option(array(''true'', ''false''),'),
('', 'reCAPTCHA Public Key', 'CONTACT_US_RECAPTCHA_PUBLIC_KEY', '', 'Public key given from reCAPTCHA website (default: blank).', @t4, '2', now(), now(), NULL, NULL),
('', 'reCAPTCHA Private Key', 'CONTACT_US_RECAPTCHA_PRIVATE_KEY', '', 'Private key given from reCAPTCHA website (default: blank).', @t4, '3', now(), now(), NULL, NULL),
('', 'reCAPTCHA Theme', 'CONTACT_US_RECAPTCHA_THEME', 'white', 'Choose a theme option for the widget.', @t4, '4', now(), now(), NULL, 'zen_cfg_select_option(array(''red'', ''white'', ''blackglass'', ''clean''),');
```Seems like allot of work just to have it on your 'contact us' page. You could copy the first line, change it to do other pages as well!!  Short Order is the number of entree's so one through total number of lines.

('', 'Enable Ask-a-Question Form', 'ASK_A_QUESTION_RECAPTCHA_STATUS', 'true', 'Disply reCAPTCHA text on Ask-a-Question form (default: true)', @t4, '5', now(), now(), NULL, 'zen_cfg_select_option(array(''true'', ''false''),'),

Dave
Always forward thinking... Lost my mind!

3 Jan 2010, 1:47 PM
#49
davemehta avatar

davemehta

Zen Follower

Join Date:
Aug 2005
Posts:
130
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

Thanks so much Davewest!!! That SQL did the trick :-)

Just a couple of notes for those of you wanting to use this in the future:

  1. Run the SQL code provided by Davewest above to get the reCaptcha code to show up in the admin. Note that you must add the prefix "zen_" to the table names "configuration_group" and "configuration" in order for the statement to work properly (if you have that prefix on your tables).

  2. The file "tpl_contact_us_default.php" provided in the custom templates folder is actually NOT in the right place... it writes that file to the "includes/templates/YOURTEMPLATE/" folder... when it should really go in the "includes/templates/YOURTEMPLATE/templates" folder. I just cut and paste the appropriate reCaptcha code into my customized contact_us template and was all set.

17 Jan 2010, 11:56 PM
#50
kinget avatar

kinget

Zen Follower

Join Date:
Jul 2006
Posts:
154
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

Sorry, I'm a bit confused by the code. :frusty: I too tried to install this module and couldn't get it to work. In fact, I couldn't get any of the captcha modules to work. Can a easy to understand, step by step instruction be provided to install this module correctly? It would be a big help.

Thanks always for the wonderful support on this forum. :smile:

davemehta:

Thanks so much Davewest!!! That SQL did the trick :-)

Just a couple of notes for those of you wanting to use this in the future:

  1. Run the SQL code provided by Davewest above to get the reCaptcha code to show up in the admin. Note that you must add the prefix "zen_" to the table names "configuration_group" and "configuration" in order for the statement to work properly (if you have that prefix on your tables).

  2. The file "tpl_contact_us_default.php" provided in the custom templates folder is actually NOT in the right place... it writes that file to the "includes/templates/YOURTEMPLATE/" folder... when it should really go in the "includes/templates/YOURTEMPLATE/templates" folder. I just cut and paste the appropriate reCaptcha code into my customized contact_us template and was all set.

27 Jan 2010, 11:41 PM
#51
nomadgimp_com avatar

nomadgimp_com

New Zenner

Join Date:
Nov 2008
Posts:
4
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

So, here's a new one!

@ http://nomadgimp.com/admin/
I get this:
"
0 DB_ERROR_NOT_CONNECTED
in:
[select * from project_version WHERE project_version_key = 'Zen-Cart Database' ]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
"

and I assume we're not at the moment concerned with the behavior for going to the end user site, described below:

when I go to my domain, i am redirected to nomadgimp.com/nddbc.html, which has the zen-cart logo, and the following message:
"
Sorry!
There seems to be a problem connecting to our database. Please give us a few minutes to remedy the problem. Thank you.
"
with a 'verify status' button, that just sends me back to the same page.
Yeah, thanks for making this plug-in though, I'll probably get it to work eventually... but hoping for a bump in the correct direction.

27 Jan 2010, 11:50 PM
#52
nomadgimp_com avatar

nomadgimp_com

New Zenner

Join Date:
Nov 2008
Posts:
4
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

So I'm trying this:

pickupman:

Since files in the extra_functions folder are auto loaded, what happens is that recaptcha_functions.php runs a query checking for a configuration key named "recaptcha". If it is not found the script calls a function invoking the install of the configuration keys. In that file you may change at line 33-36 from:

if (mysql_num_rows($result) < 1) {
// install values
install_recaptcha();
}

> and change to
> ```php
if (mysql_num_rows($result) < 1) {
		// install values
		install_recaptcha();
	}else{
		echo 'recaptcha found';	
	}

This should has a output error in the header if it is being loaded by zencart. If it does, change the code back. Make sure there are no previous reCAPTCHA keys in the database. Run the sql query (in phpMyAdmin or the like) posted above and see if the keys already exist.

but the only place I have the "num_rows" is at line 64... and I don't have anything about "install_recaptcha" anywhere.... so I can't edit it to merely echo, b/c , it's not there... hmmm....

8 Feb 2010, 5:40 AM
#53
jrayfield avatar

jrayfield

New Zenner

Join Date:
Dec 2008
Posts:
81
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

I'm having the same problems that others here have had - the 'autoinstall' doesn't work. No changes are made to the database.

I would be interested in using a different captcha add-on to Zen-Cart, but this one appeared to require the least modifications to the core files.

Can someone either provide a 'fixed' version of this add-on, or direct me to something else that will work 'as advertised'?

John Rayfield, Jr.
https://www.rayfield.net

8 Feb 2010, 12:33 PM
#55
natty avatar

natty

New Zenner

Join Date:
Dec 2008
Posts:
65
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

Hi all,

I have this working on my store. www worldofstuff co uk

I used the Contact Recaptch mod available here

I also could not get it to auto install so after much googlashion I figured that if you add ?install_recaptcha to the end of your URL it will force the install. ie .co.uk?install_recaptcha

Hope this helps others
Regards
Natty

ps - if it is not ? after the URL and before install_recaptach, please correct me. I'm still building my caffeine level up for the day.

8 Feb 2010, 2:14 PM
#56
pickupman avatar

pickupman

New Zenner

Join Date:
Jun 2009
Posts:
83
Plugin Contributions:
2

Re: Adding reCAPTCHA to Contact Us Form

I had chance to update my original version this weekend. I updated the install/uninstall, and changed some db queries. Please try the updated zip file attached. Just reupload the files in the admin folder to upgrade previous installation.
To upgrade, login into admin page, append [&remove_recaptcha=yes] to the url, and press enter. This should uninstall the previous configuration fields, and reinstall on page refresh.

Let me know if this works any better. Thanks.

9 Feb 2010, 3:47 AM
#57
jrayfield avatar

jrayfield

New Zenner

Join Date:
Dec 2008
Posts:
81
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

Where should the tpl_contact_us_default.php be placed?

Your directory structure, within the zip file, indicates that it should be in the /includes/templates/CUSTOM folder.

However, there already is a tpl_contact_us_default.php file in the /includes/templates/template_default/templates directory.

This would seem to indicate that your replacement file should go in /includes/templates/CUSTOM/templates directory, where it will override the original file (in the /template_default directory).

Does this make sense? Or am I misunderstanding something here?

John Rayfield, Jr.
https://www.rayfield.net

9 Feb 2010, 4:05 AM
#58
jrayfield avatar

jrayfield

New Zenner

Join Date:
Dec 2008
Posts:
81
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

I went ahead and put the 'tpl_contact_us_default.php' file in the '/includes/templates/CUSTOM/templates' directory and everything seems to work correctly.

John Rayfield, Jr.
https://www.rayfield.net

9 Feb 2010, 2:03 PM
#59
pickupman avatar

pickupman

New Zenner

Join Date:
Jun 2009
Posts:
83
Plugin Contributions:
2

Re: Adding reCAPTCHA to Contact Us Form

The /includes/templates/CUSTOM/ would be your custom theme folder. If you are running the default classic theme, that would be /includes/templates/classic

9 Feb 2010, 3:04 PM
#60
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: Adding reCAPTCHA to Contact Us Form

pickupman:

I had chance to update my original version this weekend. I updated the install/uninstall, and changed some db queries. Please try the updated zip file attached. Just reupload the files in the admin folder to upgrade previous installation.
To upgrade, login into admin page, append [&remove_recaptcha=yes] to the url, and press enter. This should uninstall the previous configuration fields, and reinstall on page refresh.

Let me know if this works any better. Thanks.

I tried the version 1-0 and it didn't work since I was also one of those with a /admin/ section with a different name.

I then tried to install the updated version from yesterday 1-1 and still can't get it to work.

In the instructions:

  1. recaptcha configuration will automatically load itself & sql statemtents. If you are
    reinstalling, login to admin page, append &remove_recaptcha=yes to the url. Refresh the page,
    and it will update the changes.

Where do I add that? Login to admin section then append "&remove_recaptcha=yes"

Like this? https://www.yourdomain.com/store/admin/&remove_recaptcha=yes

(admin would be replaced by your renamed admin folder)

~ jasmel : ** My Store** Using Contributions: Wallet Theme | Simple Google | Quantity Discounts | Godaddy | FAQ's | Confirm Email Address Entry | Admin login as customer | Newsletter Subscribe | CampaingMonitor