tags:

views:

72

answers:

3

I want to add captcha in myfile.ctp. For this i found source for captcha along with some resource files includs(js, php). I know the folder for js files & include this file using <?php echo $javascript->link(array('ajax_captcha.js'));?>. But I don't know where to place .php file & also how to include it in myfile.ctp

Or if anybody help me to implement Captcha in Cakephp.

A: 

For your js, use $javascript->link('ajax_captcha',false); Not the omission of the extension. false will place it in the section of the HTML. This will look for the script in webroot/js

Personally, I would just use a standard php include directive for the php side of things, bearing in mind that the location will be relative to webroot, i.e. '/myPHP/captcha.php'will be webroot/myPHP/captcha.php.

Don't forget, CakePHP is PHP.

Leo
A: 

I'd use a plugin or component, http://bakery.cakephp.org/articles/view/captcha-component-with-phpcaptcha

This works very well with PHPCaptcha for all your Human vs Computer shenanigans. Feel free to google around for your preferred plugin/component.

DavidYell
A: 

There is another article in the bakery - Integrate CakePHP with Kcaptcha (read the comments there too). I have successfully implemented kcaptcha in my application.

bancer