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

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Captcha. 2 captchas??? (/showthread.php?tid=48625)



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.