You can make captcha in yiiframework easy because yii has featured to make the captchaa easily. So let't take a look how to make the captcha in yiiframework
To make the capctha you have to do :
- Add the code rules to your controller id. For example UserController.
public function actions(){ return array( // captcha action renders the CAPTCHA image displayed on the user registration page 'captcha'=>array( 'class'=>'CCaptchaAction', 'backColor'=>0xFFFFFF, ), ); }
$form=$this->beginWidget('CActiveForm',array( 'id'=>'user-form', 'enableAjaxValidation'=>false, )); ?>Don't forget to put the access rules like this :
array('allow', // allow authenticated user to perform 'create' and 'update' actions 'actions'=>array('create','update','captcha'), 'users'=>array('@'), ),
public $verifyCode;Add this code to your view form
<?php if(extension_loaded('gd')): ?> <div class="row"> <?php echo $form->labelEx($model,'verifyCode'); ?> <div> <?php $this->widget('CCaptcha'); ?> <?php echo $form->error($model,'verifyCode'); ?> <?php echo $form->textField($model,'verifyCode'); ?> </div> </div>
<?php endif ?>
array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),Oke that's all.. rock with yii framework
Thank you very much..
ReplyDeleteI follow code given step by step.
I got Captcha now :-)
the code is very effective.....i finally got the captcha in my website.formore info visit my website
ReplyDeletecaptcha solver
Thank you very much! Your blog is really usefull.
ReplyDeletewonderful!!!its a great job.your blog is very useful and informative.thanks for sharing.
ReplyDeletekeep blogging.
death by captcha
wow!!!
ReplyDeletethe great blog.the blog is very interesting and very informative.
thanks for sharing the information.
captcha solver
Captcha image doesn't show. Any tips on troubleshooting this? I get the text field, and when I submit it tells me that capcha code is incorrect,but there is no capcha image. When I check the source, I can see the image is generated as < img id="yw0" src="/site/captcha?v=5212c61a3b9ea" alt="">.
ReplyDeleteWhen I enter that URL into the browser, it tells me that the image can't be displayed because contains errors!!?? Any ideas?
Do you have follow all the instruction.. maybe in the rules..
ReplyDeleteYou have to make sure to have access to the captcha action..
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update','captcha'),
'users'=>array('@'),
),
I followed the instructions and I do have those rules setup:
ReplyDeletepublic function accessRules()
{
return array(
array('allow',
'actions'=>array('index','contact','view','create','captcha'),
'users'=>array('*'),
),
);
}
The problem is, even the contact page generated automatically by yiic when I started the application, stopped showing the captcha. I know the server is OK because it works on another project I have, but for this project doesn't work anywhere...
I'm stuck. I tried to enable logging to find the error, but I get no error messages. I have 2 days now of searching with no success. I'm thinking to use GIT and revert back my project to the early stages to find out where it stopped working.
Hai, This is a superb Blog.. and nice informative scripts its new way to controller id further new idea for this..... they Rules and Usercontroller Script is really Superb and easy to useage... simple and super script framework is great finding... thanks for sharing..
ReplyDeleteDecaptcha
Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.Yiioverflow is a web development company.We have well expert team in Angular JS, Ionic, Yii Framework, Node JS, Laravel, PHP, MySQL, and WordPress.If you want a developer visit.. https://yiioverflow.com/
ReplyDelete