diff --git a/htdocs/application/controllers/main.php b/htdocs/application/controllers/main.php index d057180..87c96cc 100755 --- a/htdocs/application/controllers/main.php +++ b/htdocs/application/controllers/main.php @@ -388,7 +388,25 @@ class Main extends CI_Controller function captcha() { $this->load->helper('captcha'); - $this->load->view('view/captcha'); + + //get "word" + $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $str = ''; + for ($i = 0;$i < 4;$i++) + { + $str.= substr($pool, mt_rand(0, strlen($pool) - 1) , 1); + } + $word = $str; + + //save + $this->db_session->set_userdata(array( + 'captcha' => $word + )); + + //view + $this->load->view('view/captcha', array( + 'word' => $word + )); } function _valid_lang($lang) diff --git a/htdocs/application/views/view/captcha.php b/htdocs/application/views/view/captcha.php index 14cdda1..ddbd18d 100644 --- a/htdocs/application/views/view/captcha.php +++ b/htdocs/application/views/view/captcha.php @@ -1,3 +1,3 @@