title: CodeIgniter CAPTCHA validation
body: <p>I have created some form for inserting data into database and for checking if the data was sent from human I have used CAPTCHA which is already integrated to CI.</p>
  
  <p>This is my controller:</p>
  
  <pre><code>    $checkrules = array(
          'img_path' =&gt; realpath(APPPATH . '../upload/checking/img') . '/',
          'img_url' =&gt; base_url() . 'upload/checking/img/',
          'font_path' =&gt; realpath(APPPATH . '../upload/checking/font.ttf'),
          'img_width' =&gt; 150,
          'img_height' =&gt; 30,
          'expiration' =&gt; 7200
      );
  
      $check = create_captcha($checkrules);
      $data['checkimg'] = $check['image'];
  
      $this-&gt;form_validation-&gt;set_rules('name', 'Name', 'required|max_length[40]|xss_clean');
      $this-&gt;form_validation-&gt;set_rules('email', 'E-mail', 'required|valid_email|xss_clean');
      $this-&gt;form_validation-&gt;set_rules('website', 'Website', 'max_length[80]|prep_url|xss_clean');
      $this-&gt;form_validation-&gt;set_rules('comment', 'Comment', 'required|xss_clean');
      $this-&gt;form_validation-&gt;set_rules('check', 'Check', 'required|xss_clean');
  
      if ($this-&gt;form_validation-&gt;run() == FALSE)
      {
          $this-&gt;load-&gt;view('cms/theme', $data);
      }
      else
      {
          echo "success";
          $this-&gt;load-&gt;view('cms/theme', $data);
      }
  </code></pre>
  
  <p>My question now is what's the best way to validate CAPTCHA?</p>
  
  <p>1.) Creating callback, which I have already done, but there was problem because when I send form is error with new CAPTCHA code.</p>
  
  <p>2.) Inserting CAPTCHA's code into database and check from it. Problem is because there will be a lot of loading database and it will be very busy.</p>
  
  <p>And second question. Is this CAPTCHA saving only .jpg pictures in folder or it can be any other format there? (I'm asking this because I want to delete this captcha's after they are used.)</p>