MOD: Form Image Verification (CAPTCHA)

To make sure that your form(s) is not filled in by

a non-human (captcha) i have made a

captcha-script that can be easily implemented.

Again, quick & dirty and please read my notes at the the bottom.

This script is only made for the contact-us-form, but can be easily added

to other custom forms (change if-statement on line 4->captcha.tpl, thats it).



Here’s an example of the result:

__________________________________________

[ATTACH]260[/ATTACH]



__________________________________________

Directions are also included in the zip-file (below),

but here it goes anyways:











[COLOR=“Red”]STEP 1

-----------------------------------------------------------------------[/COLOR]


Go to your CS-Cart administration, click on Languages

and add these 2 variables (in each language you might use):

[COLOR=“SeaGreen”]variable:captcha_descr

value:This form uses information in an
image to prevent automated misuse.
Please enter the charachters you see:



variable:captcha_warning

value:Your verification-code is incorrect. Please try again.[/COLOR]











[COLOR=“Red”]STEP 2

-----------------------------------------------------------------------[/COLOR]


create a new subdirectory in directory “classes” and name it “captcha”,

so you now have a structure “/classes/captcha”.

extract these 3 new files from the [COLOR=“red”]zip[/COLOR] to this new directory:

[COLOR=“SeaGreen”]agent.ttf

captcha.php

captcha.png[/COLOR]














[COLOR=“Red”]STEP 3

-----------------------------------------------------------------------[/COLOR]


Put the new file [COLOR=“SeaGreen”]captcha.tpl[/COLOR] from the [COLOR=“Red”]zip[/COLOR]-file in this directory:

[COLOR=“seagreen”]/skins//customer/forms_pages/[/COLOR]













[COLOR=“Red”]STEP 4

-----------------------------------------------------------------------[/COLOR]


[COLOR=“SeaGreen”]Open the file /skins//customer/forms_pages/forms.tpl[/COLOR]



[COLOR=“SeaGreen”]Search for these 2 lines (around line 180):[/COLOR]

{/if}
{/foreach}




[COLOR=“seagreen”]Remove these 3 lines below these lines:[/COLOR]

```php


{include file="buttons/button.tpl" but_text=$lang.submit but_onclick="javascript:if (fn_check_fields('forms_form', ext_ids)) document.forms_form.submit();"} ```

[COLOR="seagreen"]And then [B][U]add[/U][/B] in place of these 3 lines (just before the ):[/COLOR]
```php {include file="forms_pages/captcha.tpl"} ```










--------------------------------------------------------------------

[IMG]http://www.ahf-muenchen.de/Veranstaltungskalender/VKathome/zipfile.gif[/IMG]
[B][COLOR="Red"]DOWNLOAD THE ZIP FILE HERE[/COLOR][/B]:
[ATTACH]281[/ATTACH]


--------------------------------------------------------------------

[COLOR="Blue"]Some notes:[/COLOR]
-the input is NOT case-sensitive!
-You can change loads of parameters in the file captcha.php like colors, font, size etc. to your likings......
f.e. you can use any ttf-font, change transparency of background-image etc........
-Javascripts needs to be supported, but no form of CS-Cart works without javascript anyways :rolleyes: .........
-This Captcha script is good. It's not the best, but good, nice and fairly easy implementable as you see and it loads extremely fast,
where the other ones that i suggested as an example where very slow and even less secure.
-This Captcha can be hacked of course, since its validated client-side, but that would take LOTS of efforts and know-how,
especially also since bots have a very hard time with handling javascript, which makes it even harder to hack.
If you find this unacceptable please create a server-side captcha script (easier to make, but less userfriendly).
-Remember that this script needs the GD library, that you also need for the
CS-Cart thumbnail-creation. Most servers have this. I tried many captcha-variants,
but this one works on most servers and is fast (selfmade....lol)!
-only tested on v1.3.4
-Help each other here with questions/remarks etc.: this script is free after all.

captcha_mod.zip

captcha.gif

Thanks Nwsco!

Thank you for sharing M8

Hi nwsco



Another nice little mod, THX,



I have a PHP script that i was going to have a go at to create a captcha mod to show on each product page as an enquire about this product. With this script you can bann, (words, IP’s and others). Would it be of any use to you.

[quote name=‘nwsco’]To make sure that your form(s) is not filled in by

a non-human (captcha) i have made a

captcha-script that can be easily implemented.

Again, quick & dirty and please read my notes at the the bottom.

This script is only made for the contact-us-form, but can be easily added

to other custom forms (change if-statement on line 4->captcha.tpl, thats it).



Here’s an example of the result:

__________________________________________

[ATTACH]260[/ATTACH]



__________________________________________

Directions are also included in the zip-file (below),

but here it goes anyways:











[COLOR=“Red”]STEP 1

-----------------------------------------------------------------------[/COLOR]


Go to your CS-Cart administration, click on Languages

and add these 2 variables (in each language you might use):

[COLOR=“SeaGreen”]variable:captcha_descr

value:This form uses information in an
image to prevent automated misuse.
Please enter the charachters you see:



variable:captcha_warning

value:Your verification-code is incorrect. Please try again.[/COLOR]











[COLOR=“Red”]STEP 2

-----------------------------------------------------------------------[/COLOR]


create a new subdirectory in directory “classes” and name it “captcha”,

so you now have a structure “/classes/captcha”.

extract these 3 new files from the [COLOR=“red”]zip[/COLOR] to this new directory:

[COLOR=“SeaGreen”]agent.ttf

captcha.php

captcha.png[/COLOR]














[COLOR=“Red”]STEP 3

-----------------------------------------------------------------------[/COLOR]


Put the new file [COLOR=“SeaGreen”]captcha.tpl[/COLOR] from the [COLOR=“Red”]zip[/COLOR]-file in this directory:

[COLOR=“seagreen”]/skins//customer/forms_pages/[/COLOR]













[COLOR=“Red”]STEP 4

-----------------------------------------------------------------------[/COLOR]


[COLOR=“SeaGreen”]Open the file /skins//customer/forms_pages/forms.tpl[/COLOR]



[COLOR=“SeaGreen”]Search for these 2 lines (around line 180):[/COLOR]

{/if}
{/foreach}




[COLOR=“seagreen”]Remove these 3 lines below these lines:[/COLOR]

```php


{include file="buttons/button.tpl" but_text=$lang.submit but_onclick="javascript:if (fn_check_fields('forms_form', ext_ids)) document.forms_form.submit();"} ```

[COLOR="seagreen"]And then [B][U]add[/U][/B] in place of these 3 lines (just before the ):[/COLOR]
```php {include file="forms_pages/captcha.tpl"} ```










--------------------------------------------------------------------

[IMG]http://www.ahf-muenchen.de/Veranstaltungskalender/VKathome/zipfile.gif[/IMG]
[B][COLOR="Red"]DOWNLOAD THE ZIP FILE HERE[/COLOR][/B]:
[ATTACH]259[/ATTACH]


--------------------------------------------------------------------

[COLOR="Blue"]Some notes:[/COLOR]
-You can change loads of parameters in the file captcha.php like colors, font, size etc. to your likings......
f.e. you can use any ttf-font, change transparency of background-image etc........
-Javascripts needs to be supported, but no form of CS-Cart works without javascript anyways :rolleyes: .........
-This Captcha script is good. It's not the best, but good, nice and fairly easy implementable as you see and it loads extremely fast,
where the other ones that i suggested as an example where very slow and even less secure.
-This Captcha can be hacked of course, since its validated client-side, but that would take LOTS of efforts and know-how,
especially also since bots have a very hard time with handling javascript, which makes it even harder to hack.
If you find this unacceptable please create a server-side captcha script (easier to make, but less userfriendly).
-Remember that this script needs the GD library, that you also need for the
CS-Cart thumbnail-creation. Most servers have this. I tried many captcha-variants,
but this one works on most servers and is fast (selfmade....lol)!
-Help each other here with questions/remarks etc.: this script is free after all.[/QUOTE]
Install it but not work

Hi nwsco



Installed well, but when you press submit button this is what you get.

[quote name=‘zardos’]

Installed well, but when you press submit button this is what you get.[/QUOTE]



The solution to the “$lang.captcha_warning” popup error is to change a line in the captcha.tpl file. In that file you will find this:



```php var cap_alert = ‘{$lang.captcha_warning}’; ```



You need to remove the quotes, so it looks like this:



```php var cap_alert = {$lang.captcha_warning}; ```



Unfortunately, there are other javascript problems as well that are causing the submit button to not work properly. It is too late to resolve the issues tonight, but maybe this weekend we can get it worked out.

[COLOR=“Red”]SOLVED[/COLOR]

sorry bout that guys/gals…



it’s fixed now in the new zipfile…

all was ready but i accidentaly moved one line, so

if you already installed this mod and dont want to do it again,

here’s the manual fix (5 second-fix!):



around line 37 in the new file

[COLOR=“SeaGreen”]skins//customer/forms_pages/captcha.tpl[/COLOR]

it says:

[COLOR=“Red”]{literal}[/COLOR]



just move this [COLOR=“Red”]{literal}[/COLOR] ONE line lower, so BELOW the “[COLOR=“red”]var cap_alert= etc etc…[/COLOR]”-line.

thats it…no biggy, just not working otherwise lol





the alert-issue ($lang.captcha_alert error) as mentioned above will also be solved by this of course…

Hi nwsco



Sorry about this nwsco, it all seems to work fine now but for one more thing, in the dropdown select boxes it is Abbreviating the Country and states.



It is fine in FF2 but not in IE7

This is a great mod and works well in FF but in IE 6 I get an error on page and it does not send the email. Anyone else get this?

i just tested in ie6, ie7 AND ff: all fine here: no errors no nothing…

sends ok.



i think you should test it without this mod first

and see what comes out of that…

remember: this mod is only tested in 1.3.4.



at least: whats the exact error you get roban?

Hi roban



I have sent 6 emails and all have gone through without a problem, just the Abbreviation of the country and states, although it does show the full country and state in the email i receive.



Thanks again nwsco nice little mod :rolleyes:

Hi nwsco,



I am using it on 1.3.3.sp2 so maybe that’s the problem. As I said it works fine in FF. The error is:



line:947

Char: 38

Error: ‘document forms_form capcode value’ is null or not an object

URL: [url]http://www.vitaminlink.net/index.php?target=forms&name=contact_us[/url]

Thanks for all the hard work nwsco, other people like to ripoff ideas and then post them for sale [url]http://bcsengineering.com/store/customer/product.php?productid=203&MMCF_newest[/url]



$30 for a stolen mod…heh?

can you beleive these dirtballs are charging $30 for this free mod…

[url]http://www.cart-lab.com/Image-Verfication-Captcha-p-116.html[/url]



Amazing that you would have to spent well over $1000 to dirtballs like this to have all the mods we have here at CS for FREE…

Just a little update on a prior post where I stated the mod did not work in IE but works in FF. The problem, as usual, was mine. I did not accurately enter the mod. All works beautifully now. Many thanks again for your unselfish share.

I just downloaded the zip and there is only 1 unkown file type present. Is the .zip corrupt?



Regards,

Scott

yeh, very odd. i didnt upload it like that i think back then.

anyways: double click this file within winzip and the rest comes up :wink:

WinRar = no workie

WinZip Pro v11 = no workie



Both say file is corrupt or incomplete



Anyway to rezip or send to scott@rc-tek.com?



Thanks!

Scott

maybe this rar in zip?

[ATTACH]282[/ATTACH]



otherwise just click here to download as rar



otherwise i am unreachable :slight_smile:

captcha_mod.zip