Codeigniter Captcha
The following example can help you adding a captcha in codeigniter framework :
$this->load->helper(‘captcha’);
$values = array(
‘img_path’ => base_path().’captcha/’,
‘font_path’ => base_path().’captcha/fonts/fontname.ttf’,
‘img_url’ => base_url().’upload/captcha/’,
‘img_width’ => ‘200’,
‘img_height’ => ’60’
);
$cp = create_captcha($values);
/* Store the captcha value in a native session */
$this->nsession->set_userdata(‘cpword’, $cp[‘word’]);
$data = array(
‘captcha_time’ => $cap[‘time’],
‘ip_address’ => $this->input->ip_address(),
‘word’ => $cap[‘word’],
‘image’ => $cap[‘image’]
);
$this->load->view(‘order/captchaform’,$data);
And inside the captchaform.php just print $image .
After submitting the captcha, match the session value with the submitted one .