Author Topic: ป้องกัน spam smf  (Read 7048 times)

ontcftqvx

  • สมาชิกใหม่
  • *
  • Posts: 0
    • View Profile
ป้องกัน spam smf
« on: April 04, 2011, 01:41:18 PM »

ที่มาของ Mod : http://custom.simplemachines.org/mods/index.php?mod=1516







เห็นหลายคนบ่นเรื่อง Spam กันมาก ผมขอแนะนำ Mod ตัวนี้เลยแล้วกันครับ

สร้างไฟล์ชื่อ add_default_settings.php อัพไปไว้ที่เดียวกับ SSI.php แล้วรัน 1 ครั้งครับ
[Copy]

<?php

if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
   require_once(dirname(__FILE__) . '/SSI.php');
elseif (!defined('SMF'))
   die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

updateSettings(array(
   'anti_spam_ver_enable' => 1,
));

if(SMF == 'SSI')
   echo 'Database settings successfully made!';

?>


เปิดไฟล์ source/Register.php

ค้นหา
[Copy]

// Are they under age, and under age users are banned?


เอาไว้ก่อนที่หา
[Copy]

// Did they answer the verification questions correctly?
   if (!empty($modSettings['anti_spam_ver_enable']))
      if (   (!empty($modSettings['anti_spam_ver_ques_1']) && strcmp(strtolower($modSettings['anti_spam_ver_ans_1']), isset($_POST['anti_spam_ver_resp_1']) ? strtolower($_POST['anti_spam_ver_resp_1']) : '')) ||
            (!empty($modSettings['anti_spam_ver_ques_2']) && strcmp(strtolower($modSettings['anti_spam_ver_ans_2']), isset($_POST['anti_spam_ver_resp_2']) ? strtolower($_POST['anti_spam_ver_resp_2']) : '')) ||
            (!empty($modSettings['anti_spam_ver_ques_3']) && strcmp(strtolower($modSettings['anti_spam_ver_ans_3']), isset($_POST['anti_spam_ver_resp_3']) ? strtolower($_POST['anti_spam_ver_resp_3']) : '')) ||
            (!empty($modSettings['anti_spam_ver_ques_4']) && strcmp(strtolower($modSettings['anti_spam_ver_ans_4']), isset($_POST['anti_spam_ver_resp_4']) ? strtolower($_POST['anti_spam_ver_resp_4']) : '')) ||
            (!empty($modSettings['anti_spam_ver_ques_5']) && strcmp(strtolower($modSettings['anti_spam_ver_ans_5']), isset($_POST['anti_spam_ver_resp_5']) ? strtolower($_POST['anti_spam_ver_resp_5']) : ''))
         )
         fatal_lang_error('anti_spam_ver_failed', false);



เปิดไฟล์ source/ManageRegistration.php
ค้นหา
[Copy]

'coppaPhone' => !empty($_POST['coppaPhone']) ? $_POST['coppaPhone'] : '',


ขึ้นบรรทัดใหม่
[Copy]

'anti_spam_ver_enable' => isset($_POST['anti_spam_ver_enable']) ? 1 : 0,
         'anti_spam_ver_ques_1' => !empty($_POST['anti_spam_ver_ques_1']) ? $_POST['anti_spam_ver_ques_1'] : '',
         'anti_spam_ver_ans_1' => !empty($_POST['anti_spam_ver_ans_1']) ? $_POST['anti_spam_ver_ans_1'] : '',
         'anti_spam_ver_ques_2' => !empty($_POST['anti_spam_ver_ques_2']) ? $_POST['anti_spam_ver_ques_2'] : '',
         'anti_spam_ver_ans_2' => !empty($_POST['anti_spam_ver_ans_2']) ? $_POST['anti_spam_ver_ans_2'] : '',
         'anti_spam_ver_ques_3' => !empty($_POST['anti_spam_ver_ques_3']) ? $_POST['anti_spam_ver_ques_3'] : '',
         'anti_spam_ver_ans_3' => !empty($_POST['anti_spam_ver_ans_3']) ? $_POST['anti_spam_ver_ans_3'] : '',
         'anti_spam_ver_ques_4' => !empty($_POST['anti_spam_ver_ques_4']) ? $_POST['anti_spam_ver_ques_4'] : '',
         'anti_spam_ver_ans_4' => !empty($_POST['anti_spam_ver_ans_4']) ? $_POST['anti_spam_ver_ans_4'] : '',
         'anti_spam_ver_ques_5' => !empty($_POST['anti_spam_ver_ques_5']) ? $_POST['anti_spam_ver_ques_5'] : '',
         'anti_spam_ver_ans_5' => !empty($_POST['anti_spam_ver_ans_5']) ? $_POST['anti_spam_ver_ans_5'] : '',


เปิดไฟล์ theme ที่ใช้ /Register.template.php ถ้าไม่มีให้ไปเปิดใน Default
หา
[Copy]

// Are there age restrictions in place?


เอาไว้ก่อนที่หา
[Copy]

// Are there any verification questions to answer?
   if (!empty($modSettings['anti_spam_ver_enable']))
   {
      if (!empty($modSettings['anti_spam_ver_ques_1']))
         echo '
               <tr valign="top">
                  <td width="40%">
                     <b>', $modSettings['anti_spam_ver_ques_1'], ':</b>
                  </td>
                  <td valign="top">
                     <input type="text" name="anti_spam_ver_resp_1" size="30" tabindex="', $context['tabindex']++, '" />
                  </td>
               </tr>';
      if (!empty($modSettings['anti_spam_ver_ques_2']))
         echo '
               <tr valign="top">
                  <td width="40%">
                     <b>', $modSettings['anti_spam_ver_ques_2'], ':</b>
                  </td>
                  <td valign="top">
                     <input type="text" name="anti_spam_ver_resp_2" size="30" tabindex="', $context['tabindex']++, '" />
                  </td>
               </tr>';
      if (!empty($modSettings['anti_spam_ver_ques_3']))
         echo '
               <tr valign="top">
                  <td width="40%">
                     <b>', $modSettings['anti_spam_ver_ques_3'], ':</b>
                  </td>
                  <td valign="top">
                     <input type="text" name="anti_spam_ver_resp_3" size="30" tabindex="', $context['tabindex']++, '" />
                  </td>
               </tr>';
      if (!empty($modSettings['anti_spam_ver_ques_4']))
         echo '
               <tr valign="top">
                  <td width="40%">
                     <b>', $modSettings['anti_spam_ver_ques_4'], ':</b>
                  </td>
                  <td valign="top">
                     <input type="text" name="anti_spam_ver_resp_4" size="30" tabindex="', $context['tabindex']++, '" />
                  </td>
               </tr>';
      if (!empty($modSettings['anti_spam_ver_ques_5']))
         echo '
               <tr valign="top">
                  <td width="40%">
                     <b>', $modSettings['anti_spam_ver_ques_5'], ':</b>
                  </td>
                  <td valign="top">
                     <input type="text" name="anti_spam_ver_resp_5" size="30" tabindex="', $context['tabindex']++, '" />
                  </td>
               </tr>';
   }


ค้นหา
[Copy]

</tr><tr class="windowbg2">
                     <td width="100%" colspan="2" align="center">
                        <hr />
                     </td>
                  </tr><tr class="windowbg2" valign="top">


แทนที่ด้วย
[Copy]

</tr>
               </table>
            </td>
         </tr>
         <tr class="titlebg">
            <td align="center">', $txt['anti_spam_ver_title'], '</td>
         </tr>
         <tr class="windowbg2">
            <td align="center">
               <table border="0" cellspacing="0" cellpadding="4" align="center" width="100%">
                  <tr class="windowbg2">
                     <th width="50%" align="right">
                        <label for="anti_spam_ver_enable_check">', $txt['anti_spam_ver_enable'], '</label>:
                     </th>
                     <td width="50%" align="left">
                        <input type="checkbox" name="anti_spam_ver_enable" id="anti_spam_ver_enable_check"', !empty($modSettings['anti_spam_ver_enable']) ? ' checked="checked"' : '', ' class="check" />
                     </td>
                  </tr><tr class="windowbg2">
                     <td colspan="2">', $txt['anti_spam_ver_descr'], '</td>
                  </tr><tr class="windowbg2">
                     <td width="50%" align="center">
                     <b>', $txt['anti_spam_ver_ques_col'], '</b>
                     </td>
                     <td width="50%" align="center">
                     <b>', $txt['anti_spam_ver_ans_col'], '</b>
                     </td>
                  </tr><tr class="windowbg2">
                     <td width="50%" align="right">
                        <input type="text" name="anti_spam_ver_ques_1" id="anti_spam_ver_ques_1_input" value="', !empty($modSettings['anti_spam_ver_ques_1']) ? $modSettings['anti_spam_ver_ques_1'] : '', '" size="60%" maxlength="60" />
                     </td>
                     <td width="50%" align="left">
                        <input type="text" name="anti_spam_ver_ans_1" id="anti_spam_ver_ans_1_input" value="', !empty($modSettings['anti_spam_ver_ans_1']) ? $modSettings['anti_spam_ver_ans_1'] : '', '" size="60%" maxlength="60" />
                     </td>
                  </tr><tr class="windowbg2">
                     <td width="50%" align="right">
                        <input type="text" name="anti_spam_ver_ques_2" id="anti_spam_ver_ques_2_input" value="', !empty($modSettings['anti_spam_ver_ques_2']) ? $modSettings['anti_spam_ver_ques_2'] : '', '" size="60%" maxlength="60" />
                     </td>
                     <td width="50%" align="left">
                        <input type="text" name="anti_spam_ver_ans_2" id="anti_spam_ver_ans_2_input" value="', !empty($modSettings['anti_spam_ver_ans_2']) ? $modSettings['anti_spam_ver_ans_2'] : '', '" size="60%" maxlength="60" />
                     </td>
                  </tr><tr class="windowbg2">
                     <td width="50%" align="right">
                        <input type="text" name="anti_spam_ver_ques_3" id="anti_spam_ver_ques_3_input" value="', !empty($modSettings['anti_spam_ver_ques_3']) ? $modSettings['anti_spam_ver_ques_3'] : '', '" size="60%" maxlength="60" />
                     </td>
                     <td width="50%" align="left">
                        <input type="text" name="anti_spam_ver_ans_3" id="anti_spam_ver_ans_3_input" value="', !empty($modSettings['anti_spam_ver_ans_3']) ? $modSettings['anti_spam_ver_ans_3'] : '', '" size="60%" maxlength="60" />
                     </td>
                  </tr><tr class="windowbg2">
                     <td width="50%" align="right">
                        <input type="text" name="anti_spam_ver_ques_4" id="anti_spam_ver_ques_4_input" value="', !empty($modSettings['anti_spam_ver_ques_4']) ? $modSettings['anti_spam_ver_ques_4'] : '', '" size="60%" maxlength="60" />
                     </td>
                     <td width="50%" align="left">
                        <input type="text" name="anti_spam_ver_ans_4" id="anti_spam_ver_ans_4_input" value="', !empty($modSettings['anti_spam_ver_ans_4']) ? $modSettings['anti_spam_ver_ans_4'] : '', '" size="60%" maxlength="60" />
                     </td>
                  </tr><tr class="windowbg2">
                     <td width="50%" align="right">
                        <input type="text" name="anti_spam_ver_ques_5" id="anti_spam_ver_ques_5_input" value="', !empty($modSettings['anti_spam_ver_ques_5']) ? $modSettings['anti_spam_ver_ques_5'] : '', '" size="60%" maxlength="60" />
                     </td>
                     <td width="50%" align="left">
                        <input type="text" name="anti_spam_ver_ans_5" id="anti_spam_ver_ans_5_input" value="', !empty($modSettings['anti_spam_ver_ans_5']) ? $modSettings['anti_spam_ver_ans_5'] : '', '" size="60%" maxlength="60" />
                     </td>
                  </tr>
               </table>
            </td>
         </tr>
         <tr class="titlebg">
            <td align="center">', $txt['anti_spam_ver_coppa'], '</td>
         </tr>
         <tr class="windowbg2">
            <td align="center">
               <table border="0" cellspacing="0" cellpadding="4" align="center" width="100%">
                  <tr class="windowbg2" valign="top">


เปิดไฟล์ Modifications.english.php เอาไว้ก่อน ?>
[Copy]

$txt['anti_spam_ver_ans_col'] = 'Answer';
$txt['anti_spam_ver_coppa'] = 'COPPA';
$txt['anti_spam_ver_descr'] = 'If you want users to answer verification questions in order to stop spam bots you should setup a number of questions in the table below. You should pick relatively simple questions. Answers are not case sensitive. You may use BBC in the questions for formatting. To remove a question simply delete the contents of that line.';
$txt['anti_spam_ver_enable'] = 'Enable verification questions';
$txt['anti_spam_ver_failed'] = 'You did not answer the verification questions correctly.';
$txt['anti_spam_ver_ques_col'] = 'Question';
$txt['anti_spam_ver_title'] = 'Verification Questions';


เปิดไฟล์ Modifications.thai-utf8.php เอาไว้ก่อน ?> [แปลไทยให้แล้วครับ]
[Copy]

$txt['anti_spam_ver_ans_col'] = 'คำตอบ';
$txt['anti_spam_ver_coppa'] = 'COPPA';
$txt['anti_spam_ver_descr'] = 'หากคุณต้องการให้ผู้ใช้งานการตรวจสอบคำถามเพื่อป้องกัน Spam Bot คุณสามารถใส่คำถามและคำตอบในตารางด้านล่างนี้ คุณสามารถใช้  BBC ในการจัดรูปแบบคำถาม';
$txt['anti_spam_ver_enable'] = 'เปิดใช้งานระบบคำถามป้องกันสแปม';
$txt['anti_spam_ver_failed'] = 'คุณตอบคำถามไม่ถูกต้อง .';
$txt['anti_spam_ver_ques_col'] = 'คำถาม';
$txt['anti_spam_ver_title'] = 'การตรวจสอบคำถาม';

    

monsterloffy

  • Guest
Re: ป้องกัน spam smf
« Reply #1 on: May 13, 2011, 10:16:41 AM »
 tao10 มาโค้ดเป็นบรรทัด บรรทัดเลยอ่ะครับ แต่ถ้า เป็น smf เราก็น่าจะดาวน์โหลด plugin ที่มันสำเร็จรูป (แล้วแต่ใครจะ need น่ะครับ หรือจะเขียนเองก้อไม่ว่าครับ) มาติดตั้ง พวก capthcha พวกนี้อ่ะ ครับ น่าจะช่วยได้เยอะเลย อิอิ สำหรับคนที่ โค้ดไม่เก่ง ครับ tao4)