[eluser]unsub[/eluser]
Hi
Alas, it doesn't work... I have no idea what I'm doing wrong at this point.
Here's what I have so far.
setting the rules for the captcha field:
Code:
$this->form_validation->set_rules('captcha','captcha','required|callback__captcha_check[captcha]');
and the callback method:
Code:
function _captcha_check($value,$field){
$exp=time()-600;
$sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?";
$binds = array($this->input->post('captcha'), $this->input->ip_address(), $exp);
$query = $this->db->query($sql, $binds);
$row = $query->row();
if ($row->count == 0){
$this->form_validation->set_value('_captcha_check[captcha]',"You entered the wrong characters. Try again.");
return FALSE;
}else{
return TRUE;
}
}
hmmm... well, at this point I can say, with complete sincerity, "AAAARRRGH!"
hehe
Now, it does catch bad entries, and won't allow a submit unless it's correct. But for some reason which I can't seem to wrap my head around, the 'set_value()' in the callback simply refuses to execute. Flat out refuses. Not even polite about it, either. Just gives me the silent treatment.
Anyone got any pointers? Something that I have misseed?
Cheers, and thanks again for the help.
-gabriel