Tommy 碎碎念

Tommy Wu's blog

« 上一篇 | 下一篇 »

限制 phpBB3 的驗證碼只輸入前四碼
post by tommy @ 18 元月, 2012 12:35

基本上, 這個修改與之前改給 SMF 用的是同一個, 只是針對 phpBB3 來改.

diff -Nur phpBB3.orig//includes/captcha/plugins/captcha_abstract.php phpBB3/includes/captcha/plugins/captcha_abstract.php
--- phpBB3.orig//includes/captcha/plugins/captcha_abstract.php 2012-01-01 23:00:17.000000000 +0800
+++ phpBB3/includes/captcha/plugins/captcha_abstract.php 2012-01-18 12:17:38.838436361 +0800
@@ -326,7 +326,10 @@
 
function check_code()
{
- return (strcasecmp($this->code, $this->confirm_code) === 0);
+ //return (strcasecmp($this->code, $this->confirm_code) === 0);
+ // we only need first 4 letters, if we got more, reject it
+ if (strlen($this->confirm_code) != 4) return false;
+ return (strcasecmp(substr($this->code, 0, 4), $this->confirm_code) === 0);
}
 
function delete_code()
diff -Nur phpBB3.orig//includes/constants.php phpBB3/includes/constants.php
--- phpBB3.orig//includes/constants.php 2012-01-01 23:00:17.000000000 +0800
+++ phpBB3/includes/constants.php 2012-01-18 12:20:43.563129711 +0800
@@ -205,7 +205,7 @@
@define('CHMOD_EXECUTE', 1);
 
// Captcha code length
-define('CAPTCHA_MIN_CHARS', 4);
+define('CAPTCHA_MIN_CHARS', 6);
define('CAPTCHA_MAX_CHARS', 7);
 
// Additional constants
diff -Nur phpBB3.orig//language/en/common.php phpBB3/language/en/common.php
--- phpBB3.orig//language/en/common.php 2012-01-18 12:10:36.848677118 +0800
+++ phpBB3/language/en/common.php 2012-01-01 23:00:17.000000000 +0800
@@ -123,8 +123,8 @@
'COLOUR_SWATCH' => 'Colour swatch',
'COMMA_SEPARATOR' => ', ', // Used in pagination of ACP & prosilver, use localised comma if appropriate, eg: Ideographic or Arabic
'CONFIRM' => 'Confirm',
- 'CONFIRM_CODE' => 'Confirmation code (first 4 letters)',
- 'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as it appears (first 4 letters). All letters are case insensitive.',
+ 'CONFIRM_CODE' => 'Confirmation code',
+ 'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as it appears. All letters are case insensitive.',
'CONFIRM_CODE_WRONG' => 'The confirmation code you entered was incorrect.',
'CONFIRM_OPERATION' => 'Are you sure you wish to carry out this operation?',
'CONGRATULATIONS' => 'Congratulations to',
diff -Nur phpBB3.orig//language/zh_cmn_hant/common.php phpBB3/language/zh_cmn_hant/common.php
--- phpBB3.orig//language/zh_cmn_hant/common.php 2012-01-18 12:10:01.745087469 +0800
+++ phpBB3/language/zh_cmn_hant/common.php 2012-01-18 12:08:56.437944350 +0800
@@ -123,8 +123,8 @@
'COLOUR_SWATCH' => '顏色取樣',
'COMMA_SEPARATOR' => ',',
'CONFIRM' => '確認',
- 'CONFIRM_CODE' => '確認代碼',
- 'CONFIRM_CODE_EXPLAIN' => '請正確輸入它所顯示的代碼,不必區分大小寫。',
+ 'CONFIRM_CODE' => '確認代碼(前四碼)',
+ 'CONFIRM_CODE_EXPLAIN' => '請正確輸入它所顯示的代碼(前四碼),不必區分大小寫。',
'CONFIRM_CODE_WRONG' => '您輸入的確認代碼有誤。',
'CONFIRM_OPERATION' => '您確認要執行這個操作嗎?',
'CONGRATULATIONS' => '恭喜您',

修改後, 建議把產生的圖檔改成 "簡單" 的那一個, 因為反正 bot 都看的懂, 沒必要弄那麼複雜, 反而讓人很難看懂.

Del.icio.us Furl HEMiDEMi Technorati MyShare
迴響
暱稱:
標題:
個人網頁:
電子郵件:
迴響

  

Bad Behavior 已經阻擋了 91 個過去 7 天試圖闖關的垃圾迴響與引用。
Power by LifeType. Template design by JamesHuang. Valid XHTML and CSS