Thanks Flash, works nice! Perhaps you can change CL_Session to just Session, that will make $this->session->userdata() work in already existing code (and one session lib should be more than enough
).
If someone would like a calculated captcha, here is some replacement code:
function captcha() // <== replace this function in CL_Auth with code below
{
$this->obj->load->plugin('captcha');
$operator = array('+', '-');
$captcha_value = mt_rand(20, 100).$operator[mt_rand(0, count($operator)-1)].mt_rand(1, 20);
$vals = array(
'word' => $captcha_value.' = ?',
'img_path' => $this->obj->config->item('CL_captcha_path'),
'img_url' => '/assets/captcha/',
'font_path' => $this->obj->config->item('CL_captcha_fonts_path'),
'img_width' => 200,
'img_height' => 50,
'expiration' => $this->obj->config->item('CL_captcha_expire')
);
$cap = create_captcha($vals);
eval("\$captcha_outcome = $captcha_value;");
$store = array(
'captcha_word' => $captcha_outcome,
'captcha_time' => $cap['time']);
// Plain, simple but effective
$this->obj->cl_session->set_flashdata($store);
// Set our captcha
$this->captcha = true;
$this->captcha_img = $cap['image'];
}
The function works perfectly out-of-the-box, but I just like the calculated code more
I used the captcha from 1.6.2, but this should work with CL_captcha too.