Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:46:52+00:00 2026-06-05T01:46:52+00:00

I implemented reCaptcha in my registration form. But i got an error when i

  • 0

I implemented reCaptcha in my registration form. But i got an error when i instert the right captcha code:

CCaptchaValidator.action “captcha” is invalid. Unable to find such an action in the current controller.

public function actionCreate()
{
    $model=new TblUsers;

    // Uncomment the following line if AJAX validation is needed
        $this->performAjaxValidation($model);

    if(isset($_POST['TblUsers']))
    {
                Yii::import('ext.recaptchalib',true);
                $privatekey = '6LfgNLoSAAAAAGBVyqeKK9qH_wG5HIGIDd2KotLB';
                $resp = recaptcha_check_answer($privatekey, $_SERVER['REMOTE_ADDR'],
                        Yii::app()->request->getParam('recaptcha_challenge_field'), 
                        Yii::app()->request->getParam('recaptcha_response_field' ) );

        $model->attributes=$_POST['TblUsers'];
                if($resp->is_valid)
                {
        if($model->save())
                    if($this->_identity===null)
    {
        $this->_identity=new UserIdentity($model->username,$model->password);
        $this->_identity->authenticate();
    }
    if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
    {
        $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
        Yii::app()->user->login($this->_identity,$duration);
                $this->redirect(array('site/index'));

        return true;
    }
    else
        return false;
    }
        }
        else
        {
    $this->render('create',array(
        'model'=>$model,
    ));
        }


}

The above code is my controler where i check the captcha. If its ok, then he should save data in the db and login, with the newly created user. If wrong code, well for now i only get a blank white page. Could need some help here please.

FAST EDIT: Ups i fixed the problem with the right code, i left some junk in the model rule, but its fine now. Even thought i still need some help to handle the thing when the code is wrong, cause i get a blank page now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:46:54+00:00Added an answer on June 5, 2026 at 1:46 am

    just render a different page with error or redirect to a different page without taking any user login actions.

    At the moment you are simply returning false if $resp is not correct. You are not rendering anything out in this case. So either render an error page

    $this->render(......)
    

    or redirect to a different page and not take any actions for login or event render the same again with error on the form field for captcha.

    As a recommendation take a look at the nesting of your if statements, it is a simple action and you are making it a bit too complex.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating Recaptcha in MVC 2.0. I used following code to create Captcha..
I implemented a U.S. find near zip code search for somebody. The coordinates of
I implemented two actions : The first action it renders Address view with consumer
I implemented a quick search in my application. But when I turned the screen,
I implemented the delegate-callback pattern between two classes without retaining the delegate. But in
I would like to implement CAPTCHA in my website for secure registration. I have
So, I've implemented ReCaptcha in my ASP.NET MVC application via these instructions: http://devlicio.us/blogs/derik_whittaker/archive/2008/12/02/using-recaptcha-with-asp-net-mvc.aspx My
Implemented UITableView with custom UITableViewCell with below code @interface ProfileSaveViewController : UITableViewController { UITableViewCell
I implemented in my app MFMessageComposeViewController for send sms. It works well, but I
I implemented RestSharp succesfully in my WP7 application, but one issue remains: When I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.