2012-01-11 69 views
0

我用笨大小寫字符驗證碼,我想使有效數據的驗證碼,驗證碼,如果混合的大小寫字符,用戶應該在輸入插入喜歡較低或大寫或混合它們。檢查與PHP

在下面的代碼

我嘗試過,但它不檢查大小寫字符,該如何解決?

我的驗證碼圖像是: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; 
} 
+0

我想檢查的情況下,敏感的方式驗證碼是veeeery用戶不友好的人可以在隨機驗證碼識別低/大寫差異或您的驗證碼是非常容易閱讀(例如,所有的字母都相同的大小),那麼它也沒用盡管如此;) – bardiir 2012-01-11 13:39:31

+0

你檢查數據庫歸類在_CI並沒有結束,這將意味着SQL檢查是不區分大小寫 – Rooneyl 2012-01-11 13:43:39

回答

0
$sql = "SELECT COUNT(*) AS count FROM captcha WHERE BINARY word = ? AND ip_address = ? AND captcha_time > ?"; 
1

試試這個SQL:

$sql = "SELECT COUNT(*) AS count FROM captcha WHERE binary word = ? AND ip_address = ? AND captcha_time > ?";