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!