• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI-Validation + Recaptcha

#1
[eluser]awpti[/eluser]
Have any of you implimented validation+Recaptcha?

I can't even fathom how to go about it without an absolute, horrid kludge of code.

I can't figure where in this process the recaptcha needs to be checked and when it does, how it get it to gracefully fail out the validation.

I know that recaptcha has 2 POST variables but I still don't see how I'd force validation to fail if they fail the captcha check.

Mainly, I'm just looking for a little help getting these two working together. I've worked very little with form validation and not at all before with captcha methods.

Code:
function index()
        {
                $rules = array
                (
                        'location'      => 'required|xss_clean',
                        'company'       => 'xss_clean',
                        'email'         => 'required|valid_email',
                        'job_title'     => 'required|xss_clean',
                        'description'   => 'required|xss_clean',
                        'to_apply'      => 'required|prep_url|xss_clean',
                        'website'       => 'required|prep_url|xss_clean'
                );

                $fields = array
                (
                        'location'      => 'Location',
                        'company'       => 'Company',
                        'email'         => 'E-Mail',
                        'job_title'     => 'Job Title',
                        'description'   => 'Description',
                        'to_apply'      => 'How to Apply',
                        'website'       => 'Website'
                );

                $this->validation->set_rules($rules);
                $this->validation->set_fields($fields);

                if ($this->validation->run() == TRUE)
                {
                        $this->view->load('add_job');
                }
                else
                {
                        $data = array
                        (
                                'location'      => $this->input->post('location'),
                                'company'       => $this->input->post('company'),
                                'email'         => $this->input->post('email'),
                                'job_title'     => $this->input->post('job_title'),
                                'description'   => $this->input->post('description'),
                                'to_apply'      => $this->input->post('to_apply'),
                                'website'       => $this->input->post('website'),
                                'is_validated'  => 0,
                                'date_created'  => date('Y-m-d H:i:s'),
                                'edit_key'      => md5(date('Y-m-d H:i:s').$this->input->post('company'))
                        );
                        if($this->addjob->add_job($data) === FALSE)
                        {
                                echo 'An error has occured. You should not see this. Sorry.';
                        }
                        else
                        {
                                redirect('/notices/post_accepted', 'header');
                        }
                }
        }


Messages In This Thread
CI-Validation + Recaptcha - by El Forum - 07-17-2008, 08:31 PM
CI-Validation + Recaptcha - by El Forum - 07-17-2008, 11:26 PM
CI-Validation + Recaptcha - by El Forum - 08-20-2008, 03:54 PM
CI-Validation + Recaptcha - by El Forum - 08-20-2008, 04:22 PM
CI-Validation + Recaptcha - by El Forum - 08-20-2008, 06:41 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.