【发布时间】:2012-01-11 22:01:38
【问题描述】:
我使用codeigniter,我想为验证码制作有效数据,如果验证码混合了大小写字符,用户应该在输入中插入小写或大写或混合它们。
在下面的代码中我试过了,但它不检查大小写字符,如何解决?
我的验证码图片如下:dAwVJ
//$cap = $this->input->post('captcha');
$cap = 'dAwVJ';// if i change this to dawvj return(output) is true, i don't want this
// Then see if a captcha exists:
$sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?";
$binds = array(
$cap,
$this->input->ip_address(),
$expiration
);
$query = $this->db->query($sql, $binds);
$row = $query->row();
if ($row->count == 0) {
return false;
} else {
return true;
}
【问题讨论】:
-
我认为以区分大小写的方式检查验证码对用户不友好,因为没有人可以识别随机验证码中的小写/大写差异,或者您的验证码很容易阅读(例如,所有字母都相同) size) 那么它仍然没用;)
-
您是否检查过数据库排序规则不以_ci结尾,这意味着sql检查不区分大小写
标签: php codeigniter captcha