/** * 验证验证码是否正确 * * @author mrmsl <*****@*****.**> * @date 2012-06-25 16:34:04 * @lastmodify 2013-01-22 11:12:24 by mrmsl * * @param string $code 验证码 * @param string $module 验证码模块 * * @return mixed 如果正确,返回true,否则返回提示信息 */ protected function _checkVerifycode($code, $module) { if ($v = C('T_VERIFYCODE_MODULE')) { //动态设置模块 by mrmsl on 2013-05-21 11:42:23 $module = $v; } $verifycode_setting = get_verifycode_setting($module); if (!$verifycode_setting['enable']) { //未开启验证码 $this->_check_verifycode = true; //通过验证码检测 return true; } if ($code === '') { //未输入验证码 return false; } if (($checked = check_verifycode($code, $module)) === true) { //转至check_verifycode验证 by mrmsl on 2012-07-13 16:54:54 $this->_check_verifycode = true; //通过验证码检测 by mrmsl on 2012-07-02 09:55:53 return true; } $error = L('VERIFY_CODE,NOT_CORRECT'); $log = get_method_line(__METHOD__, __LINE__, LOG_VERIFYCODE_ERROR) . $error . ': '; $log .= session(SESSION_VERIFY_CODE) . '(' . $verifycode_setting['order'] . ') => ' . $code; trigger_error($log); return $error; }
/** * 验证验证码是否正确 * * @author mrmsl <*****@*****.**> * @date 2012-06-25 16:34:04 * @lastmodify 2013-01-22 11:12:24 by mrmsl * * @param string $code 验证码 * @param string $module 验证码模块 * * @return mixed 如果正确,返回true,否则返回提示信息 */ protected function _checkVerifycode($code, $module) { if ($v = C('T_VERIFYCODE_MODULE')) { //动态设置模块 by mrmsl on 2013-05-21 11:42:23 $module = $v; } $verifycode_setting = get_verifycode_setting($module); if (!$verifycode_setting['enable']) { //未开启验证码 $this->_check_verifycode = true; //通过验证码检测 return true; } if ($code === '') { //未输入验证码 return false; } if (($checked = check_verifycode($code, $module)) === true) { //转至check_verifycode验证 by mrmsl on 2012-07-13 16:54:54 $this->_check_verifycode = true; //通过验证码检测 by mrmsl on 2012-07-02 09:55:53 return true; } $this->addLog(session(SESSION_VERIFY_CODE) . '(' . $verifycode_setting['order'] . ') => ' . $code, LOG_TYPE_VERIFYCODE_ERROR); return L('VERIFY_CODE,NOT_CORRECT'); }