MyBB Community Forums

Full Version: Do not allow URLs in new thread subject - Validation?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I've done a lot of things and have a lot of things in place to prevent spam.
The only ongoing problem I'm having is that spammers know they can put their URL in the subject line.
They can get away with that no matter what minimum I've set"no links allowed" to.

In the same manner that mybb validates for a subject being present when submitting the first post of a new thread...
And in the same manner that it checks for a max subject length, I want to validate for the presence of URLs in the subject and then return an error message when (for instance) "http://", "https://", ".com", ".net" and ".org" is found. Or, if you have any suggestions for anything else (url related) to validate for other than more suffixes which I'll consider if need be.

I know that I will have to create an "if {}" statement or statements in "inc > datahandlers > post.php"

That is, unless there's another (evidently super secret) way to do it within the Admin CP.

And I know that in addition, I'll have to write something like... "$this->set_error('no_urls_allowed')"

And assign the actual error message to 'no_urls_allowed' somehow, if I can't simply type in the actual message instead.
It's been over a decade since I dabbled in this and I can't find anything on this issue anywhere.

Could anyone help me with the validation code to eliminate that one last substantial chink in our armor?

--Dale

http://soloowners.net (1.8.7)
http://srkowners.com (1.8.7)
http://ampereowners.com (1.8.14)
I had this exact same problem. Some here wrote me a plugin to allow custom text to be blocked from subject lines as well as posts. However i only wanted to block keywords (specifically URLS) from being input in the subject line too. So i modified his plugin to only block the subject line.

https://github.com/metulburr/wordblock

AFter you install the plugin go to ACP -> Config -> Manage Blocked Words
Add things on the fly as spammers change their stuff every so often. Its nice because you can easily remove and add things within ACP.  

It is quite a great little plugin that removes a lot of spam. http:// seems to be the worst hit one.

NOTE. I realized that spammers after realizing they cannot post URLS into subject lines will start putting spam content in their profile fields...anywhere they can fit it in. I fixed this by just deleting accounts that have no posts after 1 month. Whatever they put in there, will be gone in that timeframe. OF course you could put a ton of regex requirements in there, but i am horrible at them.

Good luck and hope this helps you remove spam as much as it has for me.

[attachment=39859]
Hello,

Does some still uses this plugin ?

When I install the files then it blocks my configuration/plugin view Sad

DAVID
(2018-02-11, 07:53 AM)desfrags Wrote: [ -> ]Hello,

Does some still uses this plugin ?

When I install the files then it blocks my configuration/plugin view Sad

DAVID

You might have another plugin conflicting with it have you tried disabling all plugins and installing the one you need and activating it? If it works that tells me a other plugin is conflicting with it.

Also please see a list of plugins that wil help stop spam here :
https://community.mybb.com/thread-110224.html

If you need to update a plugin for 1.8 please see : 
https://community.mybb.com/thread-75646.html

Find plugins here : 
https://community.mybb.com/mods.php?acti...ry=plugins
ive never had a problem with this plugin. And i have a LOT of plugins installed.

When you say "block" do you mean the page is empty?
Do you get an error/warning in your logs?
Do you have a different ACP theme than default?

Just rechecked to make sure i didnt change anything or had any typos. Could not of as i dont have any differences in the one i am using now. The only diff is the error text which has nothing to do with it.
metulburr@ubuntu:~/repos/wordblock$ git diff
diff --git a/inc/plugins/wordblock.php b/inc/plugins/wordblock.php
index 042cc25..7d9612b 100644
--- a/inc/plugins/wordblock.php
+++ b/inc/plugins/wordblock.php
@@ -79,8 +79,8 @@ function wordblock_datahandler_post_validate_post($this)
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
 
+                error("Your post has been flagged as spam. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
             }
         }
         else
@@ -95,7 +95,7 @@ function wordblock_datahandler_post_validate_post($this)
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
+                error("Your post has been flagged as spam. Please read <a href=:...skipping...
diff --git a/inc/plugins/wordblock.php b/inc/plugins/wordblock.php
index 042cc25..7d9612b 100644
--- a/inc/plugins/wordblock.php
+++ b/inc/plugins/wordblock.php
@@ -79,8 +79,8 @@ function wordblock_datahandler_post_validate_post($this)
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
 
+                error("Your post has been flagged as spam. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
             }
         }
         else
@@ -95,7 +95,7 @@ function wordblock_datahandler_post_validate_post($this)
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
+                error("Your post has been flagged as spam. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
 
             }
         }
@@ -122,7 +122,7 @@ function wordblock_newthread_do_newthread_start()
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
+                error("Your post has been flagged as spam. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
 
             }
         }
@@ -138,7 +138,7 @@ function wordblock_newthread_do_newthread_start()
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
+                error("Your post has been flagged as spam. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
 
             }
         }
(2018-02-11, 02:05 PM)metulburr Wrote: [ -> ]ive never had a problem with this plugin. And i have a LOT of plugins installed.

When you say "block" do you mean the page is empty?
Do you get an error/warning in your logs?
Do you have a different ACP theme than default?

Just rechecked to make sure i didnt change anything or had any typos. Could not of as i dont have any differences in the one i am using now. The only diff is the error text which has nothing to do with it.
metulburr@ubuntu:~/repos/wordblock$ git diff
diff --git a/inc/plugins/wordblock.php b/inc/plugins/wordblock.php
index 042cc25..7d9612b 100644
--- a/inc/plugins/wordblock.php
+++ b/inc/plugins/wordblock.php
@@ -79,8 +79,8 @@ function wordblock_datahandler_post_validate_post($this)
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
 
+                error("Your post has been flagged as spam. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
             }
         }
         else
@@ -95,7 +95,7 @@ function wordblock_datahandler_post_validate_post($this)
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
+                error("Your post has been flagged as spam. Please read <a href=:...skipping...
diff --git a/inc/plugins/wordblock.php b/inc/plugins/wordblock.php
index 042cc25..7d9612b 100644
--- a/inc/plugins/wordblock.php
+++ b/inc/plugins/wordblock.php
@@ -79,8 +79,8 @@ function wordblock_datahandler_post_validate_post($this)
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
 
+                error("Your post has been flagged as spam. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
             }
         }
         else
@@ -95,7 +95,7 @@ function wordblock_datahandler_post_validate_post($this)
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
+                error("Your post has been flagged as spam. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
 
             }
         }
@@ -122,7 +122,7 @@ function wordblock_newthread_do_newthread_start()
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
+                error("Your post has been flagged as spam. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
 
             }
         }
@@ -138,7 +138,7 @@ function wordblock_newthread_do_newthread_start()
                 );
                 $wid = $word['wid'];
                 $db->update_query("wordblock", $update_array, "wid=$wid");
-                error("You are in violation of our rules. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
+                error("Your post has been flagged as spam. Please read <a href='http://python-forum.io/misc.php?action=help&hid=31'>here</a>");
 
             }
         }

 ^ See this post to see his problem: https://community.mybb.com/thread-215866.html
hmm i wonder why this plugin is causing him such problems.
(2018-01-15, 03:18 AM)metulburr Wrote: [ -> ]I had this exact same problem. Some here wrote me a plugin to allow custom text to be blocked from subject lines as well as posts. However i only wanted to block keywords (specifically URLS) from being input in the subject line too. So i modified his plugin to only block the subject line.

https://github.com/metulburr/wordblock

AFter you install the plugin go to ACP -> Config -> Manage Blocked Words
Add things on the fly as spammers change their stuff every so often. Its nice because you can easily remove and add things within ACP.  

It is quite a great little plugin that removes a lot of spam. http:// seems to be the worst hit one.

NOTE. I realized that spammers after realizing they cannot post URLS into subject lines will start putting spam content in their profile fields...anywhere they can fit it in. I fixed this by just deleting accounts that have no posts after 1 month. Whatever they put in there, will be gone in that timeframe. OF course you could put a ton of regex requirements in there, but i am horrible at them.

Good luck and hope this helps you remove spam as much as it has for me.
So metulburr...I finally got around to downloading and installing/activating it. So far it works like a charm.
The only  problem I have is that when it processes a violation and throws the error page that reads...
"You are in violation of our rules. Please read here." Which is fine, but...

The link embedded into "here" goes to your page: https://python-forum.io/misc.php?action=help&hid=31
If I spend some time on it, I'll probably eventually figure out how to change that link to point to a page I specify...
But I thought I'd ask, as I'm not that skilled. It would save me a lot of time if you could direct me to where to fix it.

Edit: Found it. I had to open up wordblock.php in Filezilla and modify the link so it points to my help document in four places.
But first I had to create the help document (and it's hid#) to point to by going to  Admin CP > config > Help Documents.

This could not possibly work any better! Thanks so much for this plugin.
Yeah sorry i hardcoded the links in not thinking someone after me might use it. Good to hear....and yes the plugin makes it quite nice for an anti spam feature
(2018-02-17, 01:43 PM)metulburr Wrote: [ -> ]Yeah sorry i hardcoded the links in not thinking someone after me might use it. Good to hear....and yes the plugin makes it quite nice for an anti spam feature

Installed the plugin... Rather efficient, but  a miscreant found a workaround. It doesn't detect editions. So you can create a thread with a legit title, and then come back and edit the title.
Pages: 1 2