PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, March 3, 2022

[FIXED] Yii Captcha image was not displayed on Form

 March 03, 2022     captcha, php, yii     No comments   

Issue

I have a code on view page of Captcha verification . There is no image displayed on here. i also try requirements check of CCaptcha and put code on controller for action redirect. but nothing to be improved .

My view

        <?php
        if(CCaptcha::checkRequirements()){
        $this->widget('CCaptcha'); ?>
        <?php echo $form->textField($model,'verifyCode'); ?>
        </div>
        <div class="hint">Please enter the letters as they are shown in the image above.
        <br/>Letters are not case-sensitive.</div>
        <?php echo $form->error($model,'verifyCode'); 

                }
         ?>

In my controller

public function actions()
{
    return array(
        // captcha action renders the CAPTCHA image displayed on the contact page
        'captcha'=>array(
            'class'=>'CCaptchaAction',
            'backColor'=>0xFFFFFF,
        ),

    );
}

this only i get on view . No image displayed

captcha


Solution

Thanks @gultomicro

public function accessRules(){'actions'=>array('create','captcha'), 'users'=>array('*')}

for your answer



Answered By - Babu
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing