Advertisement:

Author Topic: No Spam by Guests!  (Read 43637 times)

Offline GTSdll

  • Semi-Newbie
  • *
  • Posts: 24
  • Gender: Male
    • GTSdll Homepage
No Spam by Guests!
« on: October 09, 2006, 08:37:43 AM »
Link to Mod
Rate this Mod

This small modification makes guests & spam-bots unable to post any links on your forum.

It works like a charm on my forum, it keeps all the spam bots away :)

When a guest tries to post a message that contains a link, he will not be able to submit the message and gets informed that he should register, if he still wants to.


You can try posting a link as guest on my forum [nofollow] to see how it works.
---> GTSdll Homepage [nofollow] <---

1964

  • Guest
Re: No Spam by Guests!
« Reply #1 on: October 09, 2006, 08:48:15 AM »
Oh, I like this, one forum will utilize this.

Thank you.

1964

  • Guest
Re: No Spam by Guests!
« Reply #2 on: October 09, 2006, 08:53:16 AM »
Darn, doesn't work on RC3 yet.

I get... tried it many times.

Install Actions
Installations actions for "No Spam by Guests!":
The package you are trying to download or install is either corrupt or not compatible with this version of SMF.
« Last Edit: October 09, 2006, 09:42:55 AM by 1964 »

Offline Pedja

  • Jr. Member
  • **
  • Posts: 290
  • Gender: Male
    • Forum of Uzice
Re: No Spam by Guests!
« Reply #3 on: October 09, 2006, 10:37:35 AM »
Is it fixed on guests only or we can set permisson on member group basis (meaning: can we set some user groups to post links ond forbid for others?)

Offline GTSdll

  • Semi-Newbie
  • *
  • Posts: 24
  • Gender: Male
    • GTSdll Homepage
Re: No Spam by Guests!
« Reply #4 on: October 11, 2006, 07:01:18 AM »
I updated the mod for RC3.

Its currently fixed on guests only. Its a very simple mod anyways, i made it to keep the evil bots away ;)
I might change that if i have more free time though.

Btw,
does anyone know why "uninstall" doesnt work?
I think it worked fine on RC2... but i don't see the Uninstall link on RC3.

Edit: Nvm, installed a different version on my smf ;)
« Last Edit: October 11, 2006, 07:17:44 AM by GTSdll »
---> GTSdll Homepage [nofollow] <---

1964

  • Guest
Re: No Spam by Guests!
« Reply #5 on: October 11, 2006, 07:25:29 AM »
Thank you, no problems, works like it should, comes in real handy for Site Help forum.

Offline Mark0

  • Newbie
  • *
  • Posts: 7
    • Online TrID file identifier
Re: No Spam by Guests!
« Reply #6 on: October 19, 2006, 02:42:25 PM »
Thank you, very nice mod!

Bye!
"Remember remember the 5th of November"

Offline Pedja

  • Jr. Member
  • **
  • Posts: 290
  • Gender: Male
    • Forum of Uzice
Re: No Spam by Guests!
« Reply #7 on: October 20, 2006, 02:25:42 AM »
Great mod.

Can you add option not to have hardoced privielge on everybody but guests, but allow us to choose who can/cannot post URL's?

I have gusets disabled to post at all on my board. Everyone has to register to post. But if someone si registered it stil ldoes not mean he is spammer. Tehrefore I also have registered users quite limited in forum usage. I have user group where I put trustworthy users. When one is member of that group he has full access to forum.

I would like to use this mod of yours, but I want to allow posting url just for members of that user group.

Offline Gobo

  • Sr. Member
  • ****
  • Posts: 912
  • Gender: Male
  • Peace Be Upon You
    • Path To Peace
Re: No Spam by Guests!
« Reply #8 on: October 29, 2006, 09:00:47 PM »
hi

could you please also include the option in future versions for restricting post based membergroups from posting links?

it would be extremely useful :D

aku

Offline wing

  • Jr. Member
  • **
  • Posts: 343
    • CarTalkCanada
Re: No Spam by Guests!
« Reply #9 on: November 03, 2006, 07:48:29 AM »
Awesome! Thanks I never even thought about this and I have a spam problem as my site is growing.  I'll probably modify this to eliminate users with less than 10 post count as well, as I get people joining just to post a link at times.

« Last Edit: November 03, 2006, 07:50:45 AM by wing »

Offline wing

  • Jr. Member
  • **
  • Posts: 343
    • CarTalkCanada
Re: No Spam by Guests!
« Reply #10 on: November 03, 2006, 08:40:52 AM »
This wouldn't install in 1.0.9 I assume only the install package needs updating.  I updated the files to list 1.0.8 and 1.0.9 but when I zipped it back up it didn't recognize it as a package, I'm not sure how that works.  ???

I hate to do this, but I applied the mod manually which will come back to bite me later when I upgrade to 1.1 Final.

I'll start looking into modifying to work with users with <10 posts as a lot of spam comes that way as well.

Offline lematt

  • Semi-Newbie
  • *
  • Posts: 33
Re: No Spam by Guests!
« Reply #11 on: December 09, 2006, 02:00:05 PM »
I love this 'mod' but I am waiting for an update to update my forum, since it has made me to him essential. For when this version?.

Thank you very much

P.D Pardon for my English

Offline warner83

  • Newbie
  • *
  • Posts: 3
Re: No Spam by Guests!
« Reply #12 on: December 11, 2006, 03:14:03 PM »
is working with 1.1?

Offline DASBEAN

  • Jr. Member
  • **
  • Posts: 136
Re: No Spam by Guests!
« Reply #13 on: December 11, 2006, 04:00:10 PM »
is working with 1.1?

Was about to ask the same :) I'll give it a shot when I get home and report back.

Offline warner83

  • Newbie
  • *
  • Posts: 3
Re: No Spam by Guests!
« Reply #14 on: December 11, 2006, 04:06:34 PM »
sorry  ;) ;)

Offline DASBEAN

  • Jr. Member
  • **
  • Posts: 136
Re: No Spam by Guests!
« Reply #15 on: December 11, 2006, 06:40:07 PM »
SMF 1.1 Final:

The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

Offline wing

  • Jr. Member
  • **
  • Posts: 343
    • CarTalkCanada
Re: No Spam by Guests!
« Reply #16 on: December 11, 2006, 08:45:47 PM »
I hope this helps.. it's a hack but it will solve your problem  :-X

In 1.1 final open post.php in the sources directory and look for:
Code: [Select]
if (empty($modSettings['guest_post_no_email']))
                                {       
                                        if (!isset($_REQUEST['email']) || $_REQUEST['email'] == '')
                                                $context['post_error']['no_email'] = true;
                                        elseif (preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', stripslashes($_REQUEST['email'])) == 0)
                                                $context['post_error']['bad_email'] = true;
                                } 

Add after that block
Code: [Select]
// by NoSpamByGuests mod
                                $linkpos = strpos ($_POST['message'], "://"); // look for ://
                                if ($linkpos !== false) $context['post_error']['guest_no_link'] = true;
                                else { 
                                $linkpos = strpos ($_POST['message'], "www."); // look for www.
                                 if ($linkpos !== false) $context['post_error']['guest_no_link'] = true;
                                }

Then look for:
Code: [Select]
if (empty($modSettings['guest_post_no_email']))
                {
                        // Only check if they changed it!
                        if (!isset($row) || $row['posterEmail'] != $_POST['email'])
                        {
                                if (!allowedTo('moderate_forum') && (!isset($_POST['email']) || $_POST['email'] == ''))
                                        $post_errors[] = 'no_email';
                                if (!allowedTo('moderate_forum') && preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', stripslashes($_POST['email'])) == 0)
                                        $post_errors[] = 'bad_email';
                        }

                        // Now make sure this email address is not banned from posting.
                        isBannedEmail($_POST['email'], 'cannot_post', sprintf($txt['you_are_post_banned'], $txt[28]));
                }

Then add after that block:
Code: [Select]
// by NoSpamByGuests mod
                $linkpos = strpos ($_POST['message'], "://"); // look for ://
                if ($linkpos !== false) $post_errors[] = 'guest_no_link';
                else {
                $linkpos = strpos ($_POST['message'], "www."); // look for www.
                if ($linkpos !== false) $post_errors[] = 'guest_no_link';

                }

You now have "NoSpamByGuests" 

If you want to make this more effective, I had people that would join and then immediately spam my site after adding this little mod and my own variation I don't think I've had a spot of spam in months!

Right after the 2 blocks of NoSpamByGuests code I added my own code:
Code: [Select]
if ($user_info['posts'] < 10) {
           $linkpos = strpos ($_POST['message'], "://"); // look for ://
           if ($linkpos !== false) $post_errors[] = 'newuser_no_link';
         else {
           $linkpos = strpos ($_POST['message'], "www."); // look for www.
           if ($linkpos !== false) $post_errors[] = 'newuser_no_link';
          }
         }

This blocks new users with less than 10 posts from posting links.  You can change this to any number you want.  It's not ideal, it would work better integrated into the options in the admin menu I suppose but it stops my spam!


Offline MissYeh

  • Semi-Newbie
  • *
  • Posts: 11
Re: No Spam by Guests!
« Reply #17 on: December 28, 2006, 06:22:48 PM »
Great Mod!!

I guess this mod doesn't work for 1.1.1 ?

:)

Offline Mystique

  • Semi-Newbie
  • *
  • Posts: 42
  • Gender: Female
  • She de-mans the males!!!
    • Phule's Gold Paintball
Re: No Spam by Guests!
« Reply #18 on: January 04, 2007, 04:21:06 PM »
Yes please let us know when this works with 1.1.1 final.. as I DON'T LIKE using hacks to get things to work, because then when upgrades come along.. nothing works right.

Offline szinski

  • Jr. Member
  • **
  • Posts: 112
  • Gender: Male
  • Programmer by day, photographer by night.
    • Pizza Making
Re: No Spam by Guests!
« Reply #19 on: January 09, 2007, 07:37:09 AM »
I too love this mod. But, I have spammers who sign up as members then proceed to spam my forum. So, I needed a solution to stop "New Members" from spamming my site. Here's a modified version of the script that I put together.

Add "newbie" classification to $user_array so we can easily find it later.

$sourcedir/Load.php
Code: [Select]
<search for>
// Set up the $user_info array.
$user_info += array(
'username' => $username,
'name' => isset($user_settings['realName']) ? $user_settings['realName'] : '',
'email' => isset($user_settings['emailAddress']) ? $user_settings['emailAddress'] : '',
'passwd' => isset($user_settings['passwd']) ? $user_settings['passwd'] : '',
'language' => empty($user_settings['lngfile']) || empty($modSettings['userLanguage']) ? $language : $user_settings['lngfile'],
'is_guest' => $ID_MEMBER == 0,
</search for>

<add after>
'is_newbie' => in_array(4, $user_info['groups']),
</add after>


Moved the hyperlink construct to outside of the "is guest" construct so that it could be used to check for both guests and new users.

$sourcedir/Post.php
Code: [Select]
<search for>
if (empty($modSettings['guest_post_no_email']))
{
if (!isset($_REQUEST['email']) || $_REQUEST['email'] == '')
$context['post_error']['no_email'] = true;
elseif (preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', stripslashes($_REQUEST['email'])) == 0)
$context['post_error']['bad_email'] = true;
}
}
</search for>

<add after>

// No spam by Guests (and New Members) mod
if ($user_info['is_guest'] || $user_info['is_newbie'])
{
$linkpos = strpos ($_POST['message'], "://");    // look for ://
if ($linkpos !== false)
$context['post_error']['guest_no_link'] = true;
else
{
$linkpos = strpos ($_POST['message'], "www."); // look for www.
if ($linkpos !== false)
$context['post_error']['guest_no_link'] = true;
}
}
</add after>

<search for>
// Now make sure this email address is not banned from posting.
isBannedEmail($_POST['email'], 'cannot_post', sprintf($txt['you_are_post_banned'], $txt[28]));
}
}
</search for>

<add after>

// No spam by Guests (and New Members) mod
if ($posterIsGuest || $user_info['is_newbie'])
{
$linkpos = strpos ($_POST['message'], "://"); // look for ://
if ($linkpos !== false)
$post_errors[] = 'guest_no_link';
else {
$linkpos = strpos ($_POST['message'], "www."); // look for www.
if ($linkpos !== false)
$post_errors[] = 'guest_no_link';
}
}

</add after>

And, I changed the wording of the error message.

$languagedir/Errors.english.php
Code: [Select]
<search for>
?>
</search for>

<add before>

// by NoSpamByGuests mod
$txt['error_guest_no_link'] = 'Sorry, Guests and New Members are not allowed to post messages containing hyperlinks.';
</add before>

Thanks for an excellent mod!

Steve
« Last Edit: January 09, 2007, 07:55:12 AM by Blue Crab »