CodeIgniter Forums
Captcha. 2 captchas??? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: Captcha. 2 captchas??? (/thread-48625.html)



Captcha. 2 captchas??? - El Forum - 01-23-2012

[eluser]ThijssjihT[/eluser]
Every time a page with a captcha is visited, 2 captchas are created. I get 2 images in the folder, and 2 database rows. I use the standard captcha helper.
It's not a very big problem, becouse everything works, but it isn't very nice.

controller:
Code:
$attr = array('img_path' => './inc/captcha/', 'img_url' => base_url() . 'inc/captcha/');
$cap = create_captcha($attr);
$attr = array('captcha_time' => $cap['time'], 'ip_address' => $this->input->ip_address(), 'word' => $cap['word']);
$query = $this->db->insert_string('captcha', $attr);
$this->db->query($query);
$data['captcha'] = $cap['image'];

the $data variable is send to the view

I can't see what's wrong here.