CodeIgniter 2 - captcha helper? -
i cant seem ci2's captcha helper work... can point out doing wrong?
i think i've followed steps on doc's im not getting event 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);
}
model function input_captcha($data) { $query = $this->db->insert_string('captcha', $data); $this->db->query($query); }
view <section> <h3>you must captcha captcha before proceeding demise!</h3> <article> <?php echo form_open('admin/auth');?> <p>who f you?</p> <?php echo form_input('email', 'your real email!');?> <br> <?php echo 'submit word 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 in path's images. 1 thing, log threshold set four, getting no indication of kind of problem. set absolute paths , worked fine...
function index() { $this->load->helper('form'); $this->load->helper('captcha'); $this->load->model('captcha_model'); $vals = array( 'img_path' => '/var/www/mysite.com/images/captcha/', 'img_url' => 'http://mysite.com/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' => $data['cap']['time'], 'ip_address' => $this->input->ip_address(), 'word' => $data['cap']['word'] ); $this->captcha_model->add_captcha($cap); $data['main_content'] = 'admin/landing.php'; $this->load->view('includes/template', $data); }
Comments
Post a Comment