News:

SMF 2.1.3 has been released! Take it for a spin! Read more.

Main Menu

No Spam by Guests!

Started by GTSdll, October 09, 2006, 08:37:43 AM

Previous topic - Next topic

GTSdll

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

Oh, I like this, one forum will utilize this.

Thank you.

1964

#2
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.

Pedja

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?)

GTSdll

#4
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 ;)
---> GTSdll Homepage [nofollow] <---

1964

Thank you, no problems, works like it should, comes in real handy for Site Help forum.

Mark0

Thank you, very nice mod!

Bye!
"Remember remember the 5th of November"

Pedja

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.

Gobo

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

wing

#9
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.


wing

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.

lematt

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

warner83


DASBEAN

Quote from: warner83 on December 11, 2006, 03:14:03 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.


DASBEAN

SMF 1.1 Final:

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

wing

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:

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

// 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:
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:
// 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:

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!


MissYeh

Great Mod!!

I guess this mod doesn't work for 1.1.1 ?

:)

Mystique

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.

szinski

#19
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

<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

<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

<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

Advertisement: