{
$this->ci =& get_instance();
$this->ci->config->load('captcha');
$this->ci->load->library('Singleton_db');
$this->db = $this->ci->singleton_db->connect();
{
$this->ci =& get_instance();
$this->ci->config->load('captcha');
$this->ci->load->library('Singleton_db');
$this->db = $this->ci->singleton_db->connect();
$str_query = $this->db->insert_string('captcha', $data);
$this->db->query($str_query);
$str_query = $this->db->insert_string('captcha', $data);
$this->db->query($str_query);
}
/**
* Check againt the DB if the word(s) entered by the user ($word) matches
* the CAPTCHA and if the CAPTCHA did not expired.
}
/**
* Check againt the DB if the word(s) entered by the user ($word) matches
* the CAPTCHA and if the CAPTCHA did not expired.
*/
public function check_captcha($word)
{
// First, delete old captchas
*/
public function check_captcha($word)
{
// First, delete old captchas
- $expiration_limit = (!$this->params['expiration']
- ? 7200 : $this->params['expiration']);
+ $expiration_limit = (!$this->params['captcha_params']['expiration']
+ ? 7200 : $this->params['captcha_params']['expiration']);
$expiration = time() - $expiration_limit; // Two hour limit
$this->db->query("DELETE FROM captcha WHERE captcha_time < ".$expiration);
// TODO also delete the CAPTCHA image file
// Then see if a captcha exists:
$sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?";
$expiration = time() - $expiration_limit; // Two hour limit
$this->db->query("DELETE FROM captcha WHERE captcha_time < ".$expiration);
// TODO also delete the CAPTCHA image file
// Then see if a captcha exists:
$sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND captcha_time > ?";