Forums / Cotonti / Support / Captcha + pages

Kingsley
#1 2012-06-16 20:03

Seeing there is no guestbook thingy for Cotonti, I've made one using the normal page structure, and am using the list to display the messages

http://www.decestaro.com/index.php?e=page&c=guestbook

Problem now is the shitload of spam the owner is receiving. Ok, the messages aren't displayed on the site, but the validation list is huge.

How can I get the captcha to work in the page structure? Or is that not possible?

thank you.

Twiebie
#2 2012-06-17 00:08

Not sure if that will work, i'm sure one of the devs can answer that.

I do however have a shoutbox I build for Siena. I can add Captcha to it if you want. It's basically a guestbook then.

Edit: Added Captcha. http://bluemonday.twiebie.com/index.php?e=shoutbox

This post was edited by Twiebie (2012-06-17 01:58, 12 years ago)
Trustmaster
#3 2012-06-17 06:31

You need to add the captcha with a plugin. This normally consists of two parts.

The first is displaying the captcha tags, e.g. using 'page.add.tags' hook:

$t->assign(array(
	'PAGEADD_FORM_VERIFYIMG' => cot_captcha_generate(),
	'PAGEADD_FORM_VERIFYINPUT' => cot_inputbox('text', 'rverify', '', 'size="10" maxlength="20"'),
));

Then you need to verify what a user enters, e.g. in 'page.add.add.error' hook:

$rverify = cot_import('rverify', 'P', 'TXT');

if (!cot_captcha_validate($rverify))
{
	cot_error('captcha_verification_failed', 'rverify');
}

Normally you'd want to check that only for guests, so put it inside an if:

if ($usr['id'] == 0)
{
	// captcha code here
}
May the Source be with you!