I cant seem to get CI2’s captcha helper to work… Can someone point out what I am doing wrong?
I think I’ve followed all the steps on the doc’s but Im not getting anything event a print_r(get_defined_vars()) isnt showing anything… 🙁
My Controller
function index() {
$this->load->helper('form'); $this->load->helper('captcha'); $this->load->model('captcha');$vals = array( 'word' => 'Random word', 'img_path' => '../images/captcha/', 'img_url' => 'http://mysite/images/captcha/', 'font' => '../../system/fonts/texb.ttf', 'img_width' => '150', 'img_height' => 30, 'expiration' => 7200, "time" => time() ); $data['cap'] = create_captcha($vals); $cap = array( 'captcha_time' => $vals['time'], 'ip_address' => $this->input->ip_address(), 'word' => $vals['word'] ); $this->captcha_model->insert_captcha($cap); //print_r(get_defined_vars()); $data['main_content'] = 'admin/landing.php'; $this->load->view('includes/template', $data);}
My Modelfunction input_captcha($data) { $query = $this->db->insert_string('captcha', $data); $this->db->query($query); }
My View<section> <h3>You must captcha this captcha before proceeding to your demise!</h3> <article> <?php echo form_open('admin/auth');?> <p>Who the F are you?</p> <?php echo form_input('email', 'your real email!');?> <br> <?php echo 'Submit the word you see below:';?> <br> <?php echo $cap['image'];?> <br> <?php echo '<input type="text" name="captcha" value="" />'; ?>
<br> <?php echo form_submit('submit', 'Send It!');?>
<?php echo form_close();?> </article> </section>
The problem was in the path’s for images. One thing, even with the log threshold set to four, I was getting NO indication of any kind of problem. I set it to absolute paths and everything worked fine…