View Single Post
  #8 (permalink)  
Old 11-20-07, 08:47
sam sam is offline
BOD Member
 
Join Date: Jul 2007
Posts: 141
Send a message via Yahoo to sam
Default

Quote:
Originally Posted by Glenn View Post
Simple way i found to stop spamming on forum is ask question so that spam bot can't spam on your forum but question should be so simple that every user of forum should able to answer that question. Please answer this difficult question 1 + 1 = ?

How to fix it. Search for template directory at the path where you have installed phpbb forum & add the following code in the file profile_add_body.tpl

HTML Code:
<tr>
    <td class="row1"><span class="gen"> Please answer this difficult question 1 + 1 = ?</span></td>
    <td class="row2">
        <input type="text" class="post" style="width: 200px" name="math_question" size="6" maxlength="6" value="" />
    </td>
</tr>
To see the effect of the code browse registration page of forum.

Now from the same location search for php file includes/usercp_register.php &Go to end of file and add following code this code will verify the answer posted by visitors is correct or not.

HTML Code:
else if ( $mode == 'register' )
    {
        if ( empty($username) || empty($new_password) || empty($password_confirm) || empty($email) )
        {
            $error = TRUE;
            $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Fields_empty'];
        };

        if (!isset($_POST['math_question']) || $_POST['math_question'] != '2') {
            $error = TRUE;
            $error_msg .= (isset($error_msg) ? '<br/>' : '') . "Incorrect answer to the mathematical question...";
        }
    }
May be some spammer configure spam bot such way to ans the questions and you will face spamming problem again in that case you need to change the question and it's ans.

To change the questions need to edit question in the following line in the first code.

HTML Code:
<td class="row1"><span class="gen"> Please answer this difficult question 1 + 1 = ?</span></td>
And to change it's ans change the following line in the second code.

HTML Code:
if (!isset($_POST['math_question']) || $_POST['math_question'] != '2') {
Replace the number 2 by answer from the above line & use this is code in the php file.


Glenn.
Thanks Glenn,

I have made the changes according to your instructions and it really works for my forum it decreases the rate of spamming more than 80 percent.
Reply With Quote