PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#1 2013-09-12 14:26:41

doki
Member
Registered: 2007-04-30
Posts: 225

Anti-Spam in Signature

Honeypot stop forum stop works and eliminate 99% of spammers and bots however it doesn't get rid of human spammers which is not listed on SFS database. Is there a mod that prevent newly registered users without any post (or no. of the minimum post can be specified)for adding a signature?

Offline

 

#2 2013-09-12 22:47:05

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: Anti-Spam in Signature

I don't think there is such a mod, but you can try doing something like this:

Code:

--- C:\wamp\www\punbb\profile.php    2013-03-05 17:45:12.000000000 +0200
+++ C:\wamp\www\punbb_mod\profile.php    2013-09-12 20:22:30.000000000 +0200
@@ -18,13 +18,13 @@
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
   MA  02111-1307  USA
 
 ************************************************************************/
-
+define('MIN_POSTS_ANTI_SPAM', 10);
 
 define('PUN_ROOT', './');
 require PUN_ROOT.'include/common.php';
 
 
 $action = isset($_GET['action']) ? $_GET['action'] : null;
@@ -755,12 +755,15 @@
 
             break;
         }
 
         case 'personal':
         {
+            if ($pun_user['num_posts'] < MIN_POSTS_ANTI_SPAM && $pun_user['g_id'] > PUN_MOD)
+                message('You are not allowed to update this part of your profile until you have '.MIN_POSTS_ANTI_SPAM.' posts.');
+
             $form = extract_elements(array('realname', 'url', 'location'));
 
             if ($pun_user['g_id'] == PUN_ADMIN)
                 $form['title'] = trim($_POST['title']);
             else if ($pun_user['g_set_title'] == '1')
             {
@@ -794,12 +797,15 @@
 
             break;
         }
 
         case 'personality':
         {
+            if ($pun_user['num_posts'] < MIN_POSTS_ANTI_SPAM && $pun_user['g_id'] > PUN_MOD)
+                message('You are not allowed to update this part of your profile until you have '.MIN_POSTS_ANTI_SPAM.' posts.');
+
             $form = extract_elements(array('use_avatar'));
 
             // Clean up signature from POST
             $form['signature'] = pun_linebreaks(trim($_POST['signature']));
 
             // Validate signature
@@ -1233,12 +1239,15 @@
     </div>
 <?php
 
     }
     else if ($section == 'personal')
     {
+        if ($pun_user['num_posts'] < MIN_POSTS_ANTI_SPAM && $pun_user['g_id'] > PUN_MOD)
+            message('You are not allowed to update this part of your profile until you have '.MIN_POSTS_ANTI_SPAM.' posts.');
+
         if ($pun_user['g_set_title'] == '1')
             $title_field = '<label>'.$lang_common['Title'].'&nbsp;&nbsp;(<em>'.$lang_profile['Leave blank'].'</em>)<br /><input type="text" name="title" value="'.pun_htmlspecialchars($user['title']).'" size="30" maxlength="50" /><br /></label>'."\n";
 
         $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
         require PUN_ROOT.'header.php';
 
@@ -1300,12 +1309,15 @@
     </div>
 <?php
 
     }
     else if ($section == 'personality')
     {
+        if ($pun_user['num_posts'] < MIN_POSTS_ANTI_SPAM && $pun_user['g_id'] > PUN_MOD)
+            message('You are not allowed to update this part of your profile until you have '.MIN_POSTS_ANTI_SPAM.' posts.');
+
         $avatar_field = '<a href="profile.php?action=upload_avatar&amp;id='.$id.'">'.$lang_profile['Change avatar'].'</a>';
         if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif'))
             $avatar_format = 'gif';
         else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg'))
             $avatar_format = 'jpg';
         else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png'))

As an alternative you could disallow users to post links until they have made a certain number of posts. Since the pun_linebreaks function is applied to the message when you post/edit a posts, send an email or save your signature, that would be a good function to modify. So here is what you could do:

Open:

Code:

include/functions.php

Find:

Code:

//
// Convert \r\n and \r to \n
//
function pun_linebreaks($str)
{
    return str_replace("\r", "\n", str_replace("\r\n", "\n", $str));
}

Replace with:

Code:

//
// Convert \r\n and \r to \n
//
function pun_linebreaks($str)
{
    global $pun_user;

    define('MIN_POSTS_ANTI_SPAM', 10);

    if ($pun_user['num_posts'] < MIN_POSTS_ANTI_SPAM && $pun_user['g_id'] > PUN_MOD && stripos($str, "http://") !== false)
        message('You are not allowed to post links until you have made '.MIN_POSTS_ANTI_SPAM.' posts.');

    return str_replace("\r", "\n", str_replace("\r\n", "\n", $str));
}

Offline

 

#3 2013-09-13 08:34:58

doki
Member
Registered: 2007-04-30
Posts: 225

Re: Anti-Spam in Signature

Thanks a lot koos for your help. I've the added your line of code below on the validate signature section in profile.php since i will only implementing it in signature section, they can still upload avatar and update personal section... 

Code:

// Validate signature
    if (pun_strlen($form['signature']) > $pun_config['p_sig_length'])
        message($lang_prof_reg['Sig too long'].' '.$pun_config['p_sig_length'].' '.$lang_prof_reg['characters'].'.');
        else if (substr_count($form['signature'], "\n") > ($pun_config['p_sig_lines']-1))
        message($lang_prof_reg['Sig too many lines'].' '.$pun_config['p_sig_lines'].' '.$lang_prof_reg['lines'].'.');
        else if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && strtoupper($form['signature']) == $form['signature'] && $pun_user['g_id'] > PUN_MOD)
        $form['signature'] = ucwords(strtolower($form['signature']));

after this I added the code below:

Code:

else if ($pun_user['num_posts'] < MIN_POSTS_ANTI_SPAM && $pun_user['g_id'] > PUN_MOD)
                 message('You are not allowed to update this part of your profile until you have '.MIN_POSTS_ANTI_SPAM.' posts.');

I've decided not to go for "function pun_linebreaks" approach since it may prevent users to post images (image link) in the posts.

Last edited by doki (2013-09-13 08:36:33)

Offline

 

#4 2013-09-13 16:35:50

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: Anti-Spam in Signature

doki wrote:

I've decided not to go for "function pun_linebreaks" approach since it may prevent users to post images (image link) in the posts.

For some that might the preferable behaviour, i.e. not even allow users to post images until they have reached a certain number of posts.

Personally I prefer not to use any of the above methods. Most human spammers will usually fill in the signature part immediately after registration. I then have something to search against when using the Honeypot StopForumSpam mod's "Search users" tool, which searches for users with signatures but 0 posts. I then have evidence that these users are not legitimate users and can then report them to the SFS database (done using the Honeypot StopForumSpam mod's extra option when deleting the users).

Offline

 

#5 2013-09-14 06:43:07

doki
Member
Registered: 2007-04-30
Posts: 225

Re: Anti-Spam in Signature

I also use the feature in Honeypot stopfroum spam search tool for my main forums which I administer daily. But for the other forums i have I need to block the signature automatically since I'm not offen visit the site smile so spammer usually accumulated. The only drawback in this mod (restrict the signature) is you cannot distinguish which is legitimate and which is not since no traces of spam in signature.

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.