Using JCaptcha via API to Create Captcha

Need help with the Administration of your Joomla! 2.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
fade2clear
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Mon Mar 09, 2009 11:43 pm

Using JCaptcha via API to Create Captcha

Post by fade2clear » Sat Jul 14, 2012 12:57 am

I cannot for the life of me figure out how to use JCaptcha in my component, can anyone please give some insight.

I need to know how to load the class, the correct string of functions to output one and more importantly verify the captcha after submission.

fade2clear
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Mon Mar 09, 2009 11:43 pm

Re: Using JCaptcha via API to Create Captcha

Post by fade2clear » Fri Jul 27, 2012 6:54 pm

seriously ? someone has to have a resource on this.

xavip
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Mon Jan 19, 2009 5:33 pm

Re: Using JCaptcha via API to Create Captcha

Post by xavip » Mon Jul 30, 2012 5:19 pm

Hi There,

Quite easy!

This would need some polish/explanation, but you can try:

Code: Select all

// display de captcha field in your form
$captcha = JCaptcha::getInstance('recaptcha', array('namespace' => 'anything'));
echo $captcha->display('recaptcha', 'recaptcha');

// check recaptcha answer (return true or false)
$captcha = JCaptcha::getInstance('recaptcha', array('namespace' => 'anything'));
$answer = $captcha->checkAnswer('anything');
Regards


Locked

Return to “Administration Joomla! 2.5”