diff --git a/htdocs/application/controllers/main.php b/htdocs/application/controllers/main.php index 723dfe7..8ccae55 100644 --- a/htdocs/application/controllers/main.php +++ b/htdocs/application/controllers/main.php @@ -573,7 +573,7 @@ class Main extends CI_Controller //get "word" $pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ@'; $str = ''; - for ($i = 0;$i < 4;$i++) + for ($i = 0;$i < 8;$i++) { $str.= substr($pool, mt_rand(0, strlen($pool) - 1) , 1); } @@ -600,17 +600,35 @@ class Main extends CI_Controller function _valid_captcha($text) { - if (config_item('enable_captcha')) + if (config_item('enable_captcha') && $this->db_session->userdata('is_human') === false) { $this->form_validation->set_message('_valid_captcha', lang('captcha')); if ($this->use_recaptcha) { - return $this->_valid_recaptcha(); + + if ($this->_valid_recaptcha()) + { + $this->db_session->set_userdata('is_human', true); + return true; + } + else + { + return false; + } } else { - return strtolower($text) == strtolower($this->db_session->userdata('captcha')); + + if (strtolower($text) == strtolower($this->db_session->userdata('captcha'))) + { + $this->db_session->set_userdata('is_human', true); + return true; + } + else + { + return false; + } } } else diff --git a/htdocs/application/helpers/captcha_helper.php b/htdocs/application/helpers/captcha_helper.php index 451317e..770b6a5 100644 --- a/htdocs/application/helpers/captcha_helper.php +++ b/htdocs/application/helpers/captcha_helper.php @@ -286,7 +286,7 @@ if (!function_exists('display_captcha')) 'word' => $word, 'img_path' => '', 'img_url' => '', - 'img_width' => '110', + 'img_width' => '180', 'img_height' => '40', 'font_path' => '', 'expiration' => 7200 diff --git a/htdocs/themes/bootstrap/views/defaults/paste_form.php b/htdocs/themes/bootstrap/views/defaults/paste_form.php index 625e4ef..85e5b6b 100644 --- a/htdocs/themes/bootstrap/views/defaults/paste_form.php +++ b/htdocs/themes/bootstrap/views/defaults/paste_form.php @@ -107,7 +107,7 @@ - config->item('enable_captcha')){ ?> + config->item('enable_captcha') && $this->db_session->userdata('is_human') === false){ ?>
diff --git a/htdocs/themes/default/css/main.css b/htdocs/themes/default/css/main.css index 8666e92..bab2d36 100644 --- a/htdocs/themes/default/css/main.css +++ b/htdocs/themes/default/css/main.css @@ -146,6 +146,7 @@ h4 { #captcha { position: relative; left: 140px; + width: 174px; } .form_wrapper .item_group .item input, .form_wrapper .item_group .item select { diff --git a/htdocs/themes/default/views/defaults/paste_form.php b/htdocs/themes/default/views/defaults/paste_form.php index f6fbdc3..38de2d2 100644 --- a/htdocs/themes/default/views/defaults/paste_form.php +++ b/htdocs/themes/default/views/defaults/paste_form.php @@ -104,7 +104,7 @@ -config->item('enable_captcha')){ ?> +config->item('enable_captcha') && $this->db_session->userdata('is_human') === false){ ?>
diff --git a/htdocs/themes/geocities/views/defaults/paste_form.php b/htdocs/themes/geocities/views/defaults/paste_form.php index 4afefd0..9ac22e8 100644 --- a/htdocs/themes/geocities/views/defaults/paste_form.php +++ b/htdocs/themes/geocities/views/defaults/paste_form.php @@ -107,7 +107,7 @@ - config->item('enable_captcha')){ ?> + config->item('enable_captcha') && $this->db_session->userdata('is_human') === false){ ?>