1 頁 (共 1 頁)

註冊: 以問答方式防止廣告機器人侵入

發表於 : 2009-07-18 11:56
Barlos
##### 以下為 '基本的發問格式' #####
●主機作業系統:Linux
●快速架站程式:
●免費空間連結:
●您的上網方式:
●您安裝的程式:Apache + php + MySql
●您的 phpBB 版本:phpBB 3.05
●您的 domain (網域名稱) : intranet
●您的 phpBB 連結網址:
##### 以上為 '基本的發問格式' #####

●安裝外掛:以問答方式防止廣告機器人侵入

我在下面網址看到有人寫出一個 php 的網頁, 來做"以問答方式防止廣告機器人侵入"
http://www.ezdiy.org/forum/viewtopic.php?id=384

因為很單純, 也很有效, 比起圖形與在使用者的欄位內自設"如果你不是機器人, 請輸入一個介於 ?? 到 ?? 的數目字" 的問答有效.

代碼: 選擇全部

<?php
/*
作者: coolhd @ http://www.ezdiy.org
功能: 以問答的方式來防止 SpamBot 訊息侵入
版本: v1.1
*/

$question = array();

/*****問題與答案編輯區*********************************************************************/
/* $question[N][0] = '題目'; */
/* $question[N][1] = '答案1'; */
/* $question[N][2] = '答案2'; */

$question[0][0] = '請問 5 加 3 等於多少 ?';
$question[0][1] = '8';
$question[0][2] = 'eight';

$question[1][0] = '請問在英文單字 Free 裡面有幾個英文字母 e ?';
$question[1][1] = '2';
$question[1][2] = 'two';

$question[2][0] = 'x 加上 6 等於 9, 那麼請問 x 應該是多少 ?';
$question[2][1] = '3';
$question[2][2] = 'three';

$question[3][0] = '請問 25 減去 10 等於多少 ?';
$question[3][1] = '15';

$question[4][0] = '請問本站的網址是什麼(不包含 http://) ?';
$question[4][1] = 'www';

$question[5][0] = '請寫出 BLUE 這個英文單字的小寫。';
$question[5][1] = 'blue';

/*************************************************************************************/
session_start();

//顯示驗證欄位
function human_check_field() {
	global $pun_user, $question;
	
	$human_check_field = '';
	if ($pun_user['is_guest']) {
		$_SESSION['human_id'] = session_id();
		$question_index = rand(0,count($question)-1);
		$ask_question = $question[$question_index][0];
		$answer_counts = count($question[$question_index]);
		
		$question_answers = array();
		for($i=1; $i < $answer_counts; $i++) {
			$question_answers[] = $question[$question_index][$i];
		}
		
		$_SESSION['question_answers'] = $question_answers;
		
		$human_check_field = '
			<div class="inform">
				<fieldset>
					<legend>驗證</legend>
					<div class="infldset">
						請您回答底下問題。<br /><br />
						問題:&nbsp;<strong>'.$ask_question.'</strong><br />
						答案:&nbsp;<input type="text" size="30" maxlength="100" name="human_check_answer" value="" />
					</div>
				</fieldset>
			</div>';
	}
	echo $human_check_field;
}

//執行驗證檢查
function human_check() {
	global $question;
	
	if (!isset($_SESSION['human_id'])) {
		message('請正確地完成欄位填寫 !');
	}
	
	if (isset($_POST['human_check_answer'])) {
		$human_check_answer = strip_tags(trim($_POST['human_check_answer']));
	} else {
		$human_check_answer = null;
	}
	
	$human_check_pass = (in_array($human_check_answer, $_SESSION['question_answers'])) ? true : false;
	
	if ($human_check_pass == false) {
		message('您輸入的驗證答案錯誤 !');
	}
	
	unset($_SESSION['human_id']);
	unset($_SESSION['question_answers']);
}

?>
這邊請問需要在風格內 (Prosilver & Subsilver2) 內的 ucp_register.html 修改在哪邊?

Re: 註冊: 以問答方式防止廣告機器人侵入

發表於 : 2009-07-20 17:51
Barlos
有人有建議嗎?

Re: 註冊: 以問答方式防止廣告機器人侵入

發表於 : 2009-07-20 20:00
阿維
只要你會翻譯這個外掛就適合你使用 :-)
viewtopic.php?f=132&t=52383

Re: 註冊: 以問答方式防止廣告機器人侵入

發表於 : 2009-07-21 10:26
Barlos
您好,

您提供的需要增加資料庫, 步驟也較為繁雜.

至於 ezdiy.org 那個, 只需要找到可以放入程式碼的地方; 執行到那邊, 沒有通過, 就會停住.

感謝.

Re: 註冊: 以問答方式防止廣告機器人侵入

發表於 : 2009-07-21 11:48
心靈捕手
Barlos 寫:##### 以下為 '基本的發問格式' #####
●主機作業系統:Linux
●快速架站程式:
●免費空間連結:
●您的上網方式:
●您安裝的程式:Apache + php + MySql
●您的 phpBB 版本:phpBB 3.05
●您的 domain (網域名稱) : intranet
●您的 phpBB 連結網址:
##### 以上為 '基本的發問格式' #####

●安裝外掛:以問答方式防止廣告機器人侵入

我在下面網址看到有人寫出一個 php 的網頁, 來做"以問答方式防止廣告機器人侵入"
http://www.ezdiy.org/forum/viewtopic.php?id=384

因為很單純, 也很有效, 比起圖形與在使用者的欄位內自設"如果你不是機器人, 請輸入一個介於 ?? 到 ?? 的數目字" 的問答有效.

代碼: 選擇全部

<?php
/*
作者: coolhd @ http://www.ezdiy.org
功能: 以問答的方式來防止 SpamBot 訊息侵入
版本: v1.1
*/

$question = array();

/*****問題與答案編輯區*********************************************************************/
/* $question[N][0] = '題目'; */
/* $question[N][1] = '答案1'; */
/* $question[N][2] = '答案2'; */

$question[0][0] = '請問 5 加 3 等於多少 ?';
$question[0][1] = '8';
$question[0][2] = 'eight';

$question[1][0] = '請問在英文單字 Free 裡面有幾個英文字母 e ?';
$question[1][1] = '2';
$question[1][2] = 'two';

$question[2][0] = 'x 加上 6 等於 9, 那麼請問 x 應該是多少 ?';
$question[2][1] = '3';
$question[2][2] = 'three';

$question[3][0] = '請問 25 減去 10 等於多少 ?';
$question[3][1] = '15';

$question[4][0] = '請問本站的網址是什麼(不包含 http://) ?';
$question[4][1] = 'www';

$question[5][0] = '請寫出 BLUE 這個英文單字的小寫。';
$question[5][1] = 'blue';

/*************************************************************************************/
session_start();

//顯示驗證欄位
function human_check_field() {
	global $pun_user, $question;
	
	$human_check_field = '';
	if ($pun_user['is_guest']) {
		$_SESSION['human_id'] = session_id();
		$question_index = rand(0,count($question)-1);
		$ask_question = $question[$question_index][0];
		$answer_counts = count($question[$question_index]);
		
		$question_answers = array();
		for($i=1; $i < $answer_counts; $i++) {
			$question_answers[] = $question[$question_index][$i];
		}
		
		$_SESSION['question_answers'] = $question_answers;
		
		$human_check_field = '
			<div class="inform">
				<fieldset>
					<legend>驗證</legend>
					<div class="infldset">
						請您回答底下問題。<br /><br />
						問題:&nbsp;<strong>'.$ask_question.'</strong><br />
						答案:&nbsp;<input type="text" size="30" maxlength="100" name="human_check_answer" value="" />
					</div>
				</fieldset>
			</div>';
	}
	echo $human_check_field;
}

//執行驗證檢查
function human_check() {
	global $question;
	
	if (!isset($_SESSION['human_id'])) {
		message('請正確地完成欄位填寫 !');
	}
	
	if (isset($_POST['human_check_answer'])) {
		$human_check_answer = strip_tags(trim($_POST['human_check_answer']));
	} else {
		$human_check_answer = null;
	}
	
	$human_check_pass = (in_array($human_check_answer, $_SESSION['question_answers'])) ? true : false;
	
	if ($human_check_pass == false) {
		message('您輸入的驗證答案錯誤 !');
	}
	
	unset($_SESSION['human_id']);
	unset($_SESSION['question_answers']);
}

?>
這邊請問需要在風格內 (Prosilver & Subsilver2) 內的 ucp_register.html 修改在哪邊?
1. 印象中, 您 (自述) 論壇是架在 NB, 怎麼也會受 "機器人註冊" 的干擾呢?
2. 您提供的程式是適用 PunBB, 未必適用 phpBB.
更何況, 您都不曉得怎麼用, 如何知道它 "因為很單純, 也很有效, 比起圖形與在使用者的欄位內自設"如果你不是機器人, 請輸入一個介於 ?? 到 ?? 的數目字" 的問答有效."?
3. 最新 3.0.5 版 phpBB 在確認代碼的功能上已經增進許多.
4. 個人以為: 根本不必用外掛, 只要善用 "自訂個人資料欄位" 即可有效防止廣告機器人註冊.
參考資料:
http://phpbb-tw.net/phpbb/viewtopic.php?f=176&t=51667
http://phpbb-tw.net/phpbb/viewtopic.php?f=174&t=51671

P.S.
抱歉! 鎖定.