Forums / All Other Contributions/Addons / Captcha using TTF & GD

Captcha using TTF & GD

Views: 147,342

Results 461 to 480 of 593
4 Feb 2009, 6:16 AM
#461
davewest avatar

davewest

Totally Zenned

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

Captcha using TTF & GD

nikki72:

Hello,
I wanted to add this option to my return authorization form. I have search for link with instructions..but couldn't find any... does anyone know how to get this to work with return authorization form? I tired but to no avail :(.

thanks nicole

If it's the Return Authorization by Clyde, then for tpl_returns_default.php add the following, I placed mine just above the submit button..

<?php
// BOF Captcha
if(is_object($captcha) && (!$_SESSION['customer_id'])) {
?>
<br class="clearBoth" />
<?php echo $captcha->img(); ?>
<?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?>
<br class="clearBoth" />
<label for="captcha"><?php echo TITLE_CAPTCHA; ?></label>
<?php echo $captcha->input_field('captcha', 'id="captcha"') . ' <span class="alert">' . TEXT_CAPTCHA . '</span>'; ?>
<br class="clearBoth" />
<?php
}
// BOF Captcha
?>
```Then for the header file in >modules/pages/retuns/header_php.php  you need to add it in two places, first anywhere near the top this section of code..

//BOF Captcha
if((CAPTCHA_RETURNS != 'false') && (!$_SESSION['customer_id'])) {
require(DIR_WS_CLASSES . 'captcha.php');
$captcha = new captcha();
}
// EOF Captcha

$error = false;

> if (isset($_GET['action']) && ($_GET['action'] == 'send')) {Notice the CAPTCHA_RETURNS in the if statement, this turns it on or off through admin.  if you don't do a SQL statement to add this, you'll need to change it to something else like CAPTCHA_CONTACT_US which has an admin control.

Look for this line 
> if ($zc_validate_email and !empty($reason) and !empty($name)) {replace it with the following code..

//BOF Captcha
if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
$error = true;
$messageStack->add('returns', ERROR_CAPTCHA);
}
// if ($zc_validate_email and !empty($reason) and !empty($name)) {
if ($zc_validate_email and !empty($reason) and !empty($name) and !$error) {
//EOF Captcha

SET @configuration_group_id=0;
SELECT (@configuration_group_id:=configuration_group_id) FROM configuration_group WHERE configuration_group_title= 'CAPTCHA' LIMIT 1;

INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function) VALUES
(NULL, 'Return Authorization', 'CAPTCHA_RETURNS', 'true', 'Activate Validation on Return Authorization', @configuration_group_id, 23, NOW(), NULL, 'zen_cfg_select_option(array('true', 'false'),');

Dave
Always forward thinking... Lost my mind!

4 Feb 2009, 3:29 PM
#462
nikki72 avatar

nikki72

New Zenner

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

Re: Captcha using TTF & GD

worked like a charm! TY Nicole

4 Feb 2009, 5:05 PM
#463
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Captcha using TTF & GD

I usually make my Return Authorization form available only to registered users, but I have a current client who is insisting on Captcha even with this option activated.. So this is SWEEEEEEEEET!!! Thanks a bunch.. (BOOKMARKING THIS!!!)

davewest:

If it's the Return Authorization by Clyde, then for tpl_returns_default.php add the following, I placed mine just above the submit button..

<?php // BOF Captcha if(is_object($captcha) && (!$_SESSION['customer_id'])) { ?> <br class="clearBoth" /> <?php echo $captcha->img(); ?> <?php echo $captcha->redraw_button(BUTTON_IMAGE_CAPTCHA_REDRAW, BUTTON_IMAGE_CAPTCHA_REDRAW_ALT); ?> <br class="clearBoth" /> <label for="captcha"><?php echo TITLE_CAPTCHA; ?></label> <?php echo $captcha->input_field('captcha', 'id="captcha"') . ' <span class="alert">' . TEXT_CAPTCHA . '</span>'; ?> <br class="clearBoth" /> <?php } // BOF Captcha ?> ```Then for the header file in >modules/pages/retuns/header_php.php you need to add it in two places, first anywhere near the top this section of code.. > > ``` //BOF Captcha if((CAPTCHA_RETURNS != 'false') && (!$_SESSION['customer_id'])) { require(DIR_WS_CLASSES . 'captcha.php'); $captcha = new captcha(); } // EOF Captcha

$error = false;

> Notice the CAPTCHA_RETURNS in the if statement, this turns it on or off through admin. if you don't do a SQL statement to add this, you'll need to change it to something else like CAPTCHA_CONTACT_US which has an admin control.
>  
> Look for this line 
> replace it with the following code..
> ```
//BOF Captcha
  if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
    $error = true;
    $messageStack->add('returns', ERROR_CAPTCHA);
  }
//  if ($zc_validate_email and !empty($reason) and !empty($name)) {
  if ($zc_validate_email and !empty($reason) and !empty($name) and !$error) {
 //EOF Captcha
```To turn it on or off in admin.. add a sql statement using the Zen-Cart Sql Patches tool. **Please backup your database before doing this**... you never know when something will go wrong.. 
> ```
SET @configuration_group_id=0;
SELECT (@configuration_group_id:=configuration_group_id) FROM configuration_group WHERE configuration_group_title= 'CAPTCHA' LIMIT 1;
 
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function) VALUES 
(NULL, 'Return Authorization', 'CAPTCHA_RETURNS', 'true', 'Activate Validation on Return Authorization', @configuration_group_id, 23, NOW(), NULL, 'zen_cfg_select_option(array(\'true\', \'false\'),');
```Again... **BACKUP** before running the SQL statement.. I do my testing on a testing server before making any changes to a live site!

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

5 Feb 2009, 3:53 AM
#464
davewest avatar

davewest

Totally Zenned

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

Re: Captcha using TTF & GD

Keep in mind that this line turns it off for log in customers.

if((CAPTCHA_RETURNS != 'false') && (!$_SESSION['customer_id'])) {If you wish to run it for all customers even log in ones, change it to this..

if (CAPTCHA_RETURNS != 'false')  {

Glade it helped!

Dave
Always forward thinking... Lost my mind!

5 Mar 2009, 7:12 AM
#465
nsanford avatar

nsanford

New Zenner

Join Date:
Dec 2007
Posts:
69
Plugin Contributions:
1

Re: Captcha using TTF & GD

Hi,
I was testing this on a clean install on my local server, and all was going well until I installed the "Display Inc/Ex Tax or VAT Prices" module. Now I get the "enable this picture" text instead of the image. I ran the captcha_debug.php, but it may as well be chinese.

captcha::__set_state(array(
   'captchaCode' => 'K97W',
   'captchaCode_length' => 4,
   'img_width' => 240,
   'img_height' => 50,
   'img_type' => 'jpeg',
   'chars_min_size' => 0.6,
   'chars_max_size' => 0.8,
   'chars_shadow' => true,
   'chars_rotation' => 23,
   'noise' => 30,
   'backgroundColor' => 
  array (
    0 => 
    array (
      0 => 220,
      1 => 220,
      2 => 220,
    ),
    1 => 
    array (
      0 => 255,
      1 => 255,
      2 => 255,
    ),
  ),
   'linesColor' => 
  array (
    0 => 
    array (
      0 => 150,
      1 => 150,
      2 => 150,
    ),
    1 => 
    array (
      0 => 185,
      1 => 185,
      2 => 185,
    ),
  ),
   'textColor' => 
  array (
    0 => 
    array (
      0 => 30,
      1 => 30,
      2 => 30,
    ),
    1 => 
    array (
      0 => 199,
      1 => 199,
      2 => 199,
    ),
  ),
   'dir_fs_fonts' => 'C:/wamp/www/CLEAN MODIFIED SITE/fonts/',
   'ttf_list' => 
  array (
    0 => 'C:/wamp/www/CLEAN MODIFIED SITE/fonts/VERDANA.TTF',
  ),
   'max_try' => 5,
   'failure_proc' => '',
   'quality' => 60,
   'chars' => 
  array (
    0 => '1',
    1 => '2',
    2 => '3',
    3 => '4',
    4 => '5',
    5 => '6',
    6 => '7',
    7 => '8',
    8 => '9',
    9 => 'A',
    10 => 'B',
    11 => 'C',
    12 => 'D',
    13 => 'E',
    14 => 'F',
    15 => 'G',
    16 => 'H',
    17 => 'I',
    18 => 'J',
    19 => 'K',
    20 => 'L',
    21 => 'M',
    22 => 'N',
    23 => 'O',
    24 => 'P',
    25 => 'Q',
    26 => 'R',
    27 => 'S',
    28 => 'T',
    29 => 'U',
    30 => 'V',
    31 => 'W',
    32 => 'X',
    33 => 'Y',
    34 => 'Z',
  ),
   '_background' => NULL,
   'img' => NULL,
   '_gd_version' => 
  array (
    'GD Version' => 'bundled (2.0.34 compatible)',
    'FreeType Support' => true,
    'FreeType Linkage' => 'with freetype',
    'T1Lib Support' => true,
    'GIF Read Support' => true,
    'GIF Create Support' => true,
    'JPG Support' => true,
    'PNG Support' => true,
    'WBMP Support' => true,
    'XPM Support' => false,
    'XBM Support' => true,
    'JIS-mapped Japanese Font Support' => false,
    'version' => '2',
  ),
   'debug' => true,
   'img_href' => 'http://localhost/CLEAN MODIFIED SITE/captcha_img.php?zenid=cjr7niaienpcclr2hb9hmqqdb0',
   'imageColorFunc' => 'imagecolorallocate',
))

Any suggestions on what could be the problem?
TIA

11 Mar 2009, 1:09 AM
#466
freeohio avatar

freeohio

New Zenner

Join Date:
Dec 2007
Posts:
9
Plugin Contributions:
0

Re: Captcha using TTF & GD

I'm also having the "enable this picture" issue. I've uninstalled and reinstalled multiple times. I've read all the pages. I've updated my .htaccess. I'm fairly confident it isn't a coding issue, as I've replaced the MYTEMPLATE/account code with my archived code after determining that I don't need it (just want the contact_us).

When I run captcha_debug.php it bounces me to my home page. Does that mean there are no errors?

When I look at the code in Firebug I see the image is secure (https). That is strange.

Thanks in advance for the help.

24 Mar 2009, 3:02 AM
#467
giftmeister avatar

giftmeister

Zen Follower

Join Date:
Jan 2009
Location:
Montreal, Canada
Posts:
230
Plugin Contributions:
0

Re: Captcha using TTF & GD

I also had the "enable this picture" problem, read the posts, tried different things and then realized- the captcha_img.php file needs to be uploaded to the root directory (or the same directory as /includes). :bangin:

That may be obvious to some, but not to a layman like me. The readme file doesn't mention it and I thought it was part of the other non-upload files like install.slq, update, etc.

Robbie

28 Mar 2009, 11:04 AM
#468
misticloudz avatar

misticloudz

New Zenner

Join Date:
Oct 2007
Posts:
52
Plugin Contributions:
0

Re: Captcha using TTF & GD

Hi all,
I'm trying to install this module on the NEW site I'm building, and I seem to have buggered something up with the install. The contact us page and the tell-a-friend page both come up completely blank. I've tried to search through this thread to help solve the problem, but in all honesty I'm a bit lost.

And I feel pretty silly saying this but I don't know how to run a debug file or whatever it is...

I'm running several mods, FEC, COWOA, and a few others that I'd honestly have to go and look up to find. The test site is at w w w . t i f f s t r i n k e t s . c o m / f r d t e s t (sorry I don't want it indexed :P)

Now, it doesn't break the account creation page, but the tell a friend and contact us pages come up completely blank. Oddly enough, there was ALREADY a 'captcha' edit in the tpl_modules_create_account.php file that I had in there... I'm not sure why. I am (almost) 100% sure that I have not tried to install ANY captcha module on this test site yet... I've only been working on it for a couple of months now. I do have a pretty bad memory, but not THAT bad. :blink:

I have tested it on the create-account page, and I do have to input the characters to create an account, so I know that part of it, at least, is working. It's really the 'contact us' page that I'm most worried about; I get the most problems from that page.

If anybody can help, I'd really appreciate it. Thanks all! :unsure:

Tiffany Rose
Frozen Rose Design

28 Mar 2009, 11:29 AM
#469
misticloudz avatar

misticloudz

New Zenner

Join Date:
Oct 2007
Posts:
52
Plugin Contributions:
0

Re: Captcha using TTF & GD

Nevermind, everyone. ... :oops:

I had renamed the captcha files in a way that the page was still loading them, and it broke it.

(more detailed explanation: I had made all of my edits but kept the original mod files, just renamed them as header_php.captcha.php etc. so I had the untouched mod files if I needed them, but this rename wasn't quite enough! I changed it to captcha.header_php.php or somesuch and now my page works again...)

Whew! :bigups:
I always seem to figure out my own problems RIGHT after I make a forum post about it... :)

Tiffany Rose
Frozen Rose Design

28 Mar 2009, 9:07 PM
#470
davewest avatar

davewest

Totally Zenned

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

Re: Captcha using TTF & GD

misticloudz:

I always seem to figure out my own problems RIGHT after I make a forum post about it... :)

Always helps to talk it through.... also, file renaming for backups. Best to remove them to a backup set of your store or just remove the extension '.php' change it to something like'.bak' or '.old'. leaving the '.php' even renaming the file can lead to more problems.

Dave
Always forward thinking... Lost my mind!

24 Apr 2009, 7:23 PM
#471
harry2cool avatar

harry2cool

Zen Follower

Join Date:
Oct 2005
Posts:
280
Plugin Contributions:
0

Re: Captcha using TTF & GD

Hi,
I installed this mod, could see Captcha on the "Tell A Friend" Page, however cannot see it on the "Create Account Page"

I have rechecked the Modules and Templates folder twice, Where can I be wrong, any help will be appreciated.

The Sql has been installed, and the configuration page says "Yes" while testing for "Create Account" page

24 Apr 2009, 10:55 PM
#472
awhfy99 avatar

awhfy99

Zen Follower

Join Date:
Feb 2007
Location:
Burleson. Texas
Posts:
196
Plugin Contributions:
0

Re: Captcha using TTF & GD

Haven't seen this mentioned anywhere so I thought I would see if it had a solution. The captcha doesn't display the code (it's a broken image link) if either Customer Approval Status - Authorization Pending or Customer Shop Status - View Shop and Prices are set to 1 (must be authorized to browse) and/or (must login to browse). Seems to work on any of the other settings.

I did think of a use for that broken link.

If you only want the add customer through admin to be used to create an account, then either of those will definately stop them in their tracks! Actually, a pixel_trans.gif renamed to button_create_account.gif works better, but why be picky?

Dennis
www.stampdays.com
Over 80,000 stamps and still growing!

24 Apr 2009, 11:04 PM
#473
awhfy99 avatar

awhfy99

Zen Follower

Join Date:
Feb 2007
Location:
Burleson. Texas
Posts:
196
Plugin Contributions:
0

Re: Captcha using TTF & GD

harry2cool:

Hi,
I installed this mod, could see Captcha on the "Tell A Friend" Page, however cannot see it on the "Create Account Page"

I have rechecked the Modules and Templates folder twice, Where can I be wrong, any help will be appreciated.

The Sql has been installed, and the configuration page says "Yes" while testing for "Create Account" page

Weird, I see it on my create account, tell-a-friend and contact us but not on the login (split screen mode). It's optioned in the config for the login but does not show. Wasn't planning on using it there, but....

Dennis
www.stampdays.com
Over 80,000 stamps and still growing!

28 Apr 2009, 3:11 AM
#474
sara_spixels avatar

sara_spixels

New Zenner

Join Date:
May 2008
Posts:
15
Plugin Contributions:
0

Re: Captcha using TTF & GD

I'm using version 2.9 of this mod and all of a sudden (not sure how long this has been going on) my login and contact us pages are completely blank.

I used the Debug Error Logging Utility and this is the error that appears:

PHP Fatal error: Call to a member function close() on a non-object in /home/saraspix/public_html/mypixelprints.com/includes/classes/captcha.php on line 341

I haven't edited this file since I installed the mod (back in January) so I have no clue what's going on. I have turned off the CAPTCHA on for now but I really REALLY need this mod as I get swamped with spam if I don't have something to stop the bots.

Thanks in advance for any help on this :)

29 Apr 2009, 2:18 AM
#475
missesbeehaven avatar

missesbeehaven

New Zenner

Join Date:
Apr 2009
Posts:
57
Plugin Contributions:
0

Re: Captcha using TTF & GD

Hi, thanks for such a great mod to zen cart.

I have the mod installed as per the instructions and I can see the captcha image on the appropriate pages on the store however I do not have the Admin > Configuration > Captcha option?

Can any one offer help as to why this may be or what I have missed? I have triple checked the instructions and what I have done and I am darn if I can see what i have did wrong or missed as to why I do not have the Captcha appearing in the Configuration menu.

You can see the site at https://www.missesbeehaven.com/shop/index.php

Melanie
beehavendesignz DOT com

29 Apr 2009, 8:59 AM
#476
awhfy99 avatar

awhfy99

Zen Follower

Join Date:
Feb 2007
Location:
Burleson. Texas
Posts:
196
Plugin Contributions:
0

Re: Captcha using TTF & GD

missesbeehaven:

Hi, thanks for such a great mod to zen cart.

I have the mod installed as per the instructions and I can see the captcha image on the appropriate pages on the store however I do not have the Admin > Configuration > Captcha option?

Can any one offer help as to why this may be or what I have missed? I have triple checked the instructions and what I have done and I am darn if I can see what i have did wrong or missed as to why I do not have the Captcha appearing in the Configuration menu.

You can see the site at www.missesbeehaven.com/shop/index.php

What comes to mind is the patch. If it was inserted correctly then you should have a Captcha option added to the end of your configuation tab.

If you missed that, just open install_captcha.sql with notepad, do a select all and copy/paste it with the tools option. if you upgraded from an earlier version, you may want to try the version specific sql patch.

Hope it is as simple as that!

If you did the patch, then pleasee disreard my reply.:smile:

Dennis
www.stampdays.com
Over 80,000 stamps and still growing!

29 Apr 2009, 9:43 AM
#477
awhfy99 avatar

awhfy99

Zen Follower

Join Date:
Feb 2007
Location:
Burleson. Texas
Posts:
196
Plugin Contributions:
0

Re: Captcha using TTF & GD

sara*spixels:

I'm using version 2.9 of this mod and all of a sudden (not sure how long this has been going on) my login and contact us pages are completely blank.

I used the Debug Error Logging Utility and this is the error that appears:

PHP Fatal error: Call to a member function close() on a non-object in /home/saraspix/public_html/mypixelprints.com/includes/classes/captcha.php on line 341

I haven't edited this file since I installed the mod (back in January) so I have no clue what's going on. I have turned off the CAPTCHA on for now but I really REALLY need this mod as I get swamped with spam if I don't have something to stop the bots.

Thanks in advance for any help on this :)

My best guess (don't think it would actually qualify as help though):

Since line 341 in the classes/captcha.php is

function _get_gd_version() {

I am led to believe that gd library is not either installed on your server, is broken, or some parameter has been changed.

Most hosts will let their users see that info, so if you can verify that gd lib is there, and if it is, then I would check with your host. They may have done an upgrade and haven't tweaked it yet.

If anyone has a better suggestion, please let us know!

Dennis
www.stampdays.com
Over 80,000 stamps and still growing!

29 Apr 2009, 6:25 PM
#478
halligulli avatar

halligulli

New Zenner

Join Date:
Apr 2009
Posts:
1
Plugin Contributions:
0

Re: Captcha using TTF & GD

haello,
use sql in ur database. then it works correct!

greetz

30 Apr 2009, 3:22 PM
#479
sara_spixels avatar

sara_spixels

New Zenner

Join Date:
May 2008
Posts:
15
Plugin Contributions:
0

Re: Captcha using TTF & GD

Dennis,

Thanks for the reply...but what is the gd library??

How do I know if it's there or missing?

Thanks!

30 Apr 2009, 5:16 PM
#480
sara_spixels avatar

sara_spixels

New Zenner

Join Date:
May 2008
Posts:
15
Plugin Contributions:
0

Re: Captcha using TTF & GD

Also I have two Zen Carts, both on the same servers, both run with this mod...one is working just great and this one isn't. What could that mean??