View Full Version : Allow URLs in posts only after a minimum number of posts (to reduce spam)
Erwin
10-16-2002, 10:00 PM
Allow URLs in posts only after a minimum number of posts (to reduce spam)
I did this mini-hack to reduce the amount of spammers and newbie mistakes at my forums. Most of the newbies at my site do not read the rules, and in their enthusiasm post links back to their own sites or forums.
I have made it so that members need to have a minimum number of posts before they can post URLs to website. On my site I've set it to 15, but you can set it to whatever you like. If a member has less than the required amount of posts, when they try to post they get redirected to an error page, telling them that they need to have a minimum amount of posts before they can post links in their post. In my error message, I also tell them to post links to their own site only in our forum designated for website links.
Update: Version 1.1 - fixed up a loophole. Just replace the old code with the new.
Version 2.0 - tidied up the code, added code to editpost.php, made it easier to change the variable
Anyway, installation is a breeze. The installation text file is below:
Erwin
10-17-2002, 11:17 AM
<u>Screenshot</u>
This is a screenshot of the error message that the member will be redirected to if he or she has less that the minimum number of posts required and tries to post a message that has a website address or URL in it.
Remember, you can customize this error message to suit your site.
looks good erwin... :)
a little tip, when variable values are involved like that? try always to add them into global.php.
so your $allowurl should be identified to something like that:
// allow url's after xx posts
$allowurl = 15;
will be alot easier to be changed onto one file, then to look through several ones, in case the user tries to change the value after... that will make it easier on newcommers to find something in php files.
let me know what you think.
Erwin
10-17-2002, 11:25 AM
True, but in the case of this mini-hack, editing 2 files is easier than 3 files for newbies. :) Not worth making the $allowurl variable global if it's only going to be used in those 2 files, plus I don't want newbies mucking around in global.php just in case. But yeah, people can do that if they wish.
NTLDR
10-17-2002, 11:26 AM
Simple yet usefull Hack Erwin, thanks for sharing, I'll probably install this one :)
freeshares1
10-17-2002, 11:35 AM
Erwin,
This is a fantasic but simple idea, I get a lot of spam and this would help to reduce that.
Thanks
Erwin
10-17-2002, 11:41 AM
Thanks guys. :) If you like it and use it, please click install, so that I can keep track of how many installers there are, and also in case I update the hack and need to inform the installers. :)
Great hack Erwin!
It's a shame that after seeing the error message, a spammer would probably just type in the URL with a space after the "www." or something similar. :(
As a addon to what TECK said you could also place a unset(); just above it.
Erwin
10-17-2002, 07:41 PM
Originally posted by john.eovie
Great hack Erwin!
It's a shame that after seeing the error message, a spammer would probably just type in the URL with a space after the "www." or something similar. :(
Hi john! Long time no see! :)
Yeah, at least if they bypass this hack by adding spaces and such the URL won't be clickable. And we will know then that they are a "true spammer" rather than an unknowing newbie.
Erwin
10-17-2002, 07:54 PM
Originally posted by Neo
As a addon to what TECK said you could also place a unset(); just above it.
There's no real need to do that, but I've decided to restrict the file edits to only newthread.php and newreply.php to keep things simple.
Dark Shogun
10-18-2002, 08:44 PM
Can you make it so it only works with the registered user group because my admins, mods, and super mods can post any. :(
Dark Shogun
Chris M
10-18-2002, 09:26 PM
Wow...
Nice little hack Erwin:D
Satan
Erwin
10-18-2002, 11:18 PM
Originally posted by Dark Shogun
Can you make it so it only works with the registered user group because my admins, mods, and super mods can post any. :(
Dark Shogun
Your staff have less than the minimum post count required??? :eek:
Easy fix...
In BOTH newthread.php AND newreply.php, find:
$allowurl = 15;
if($bbuserinfo[posts] < $allowurl and strstr($message,'[url]')) {
eval("standarderror(\"".gettemplate("error_nourlallowed")."\");");
exit;
}
Change it to:
if ($bbuserinfo[usergroupid]!=5 or $bbuserinfo[usergroupid]!=6 or $bbuserinfo[usergroupid]!=7) {
$allowurl = 15;
if($bbuserinfo[posts] < $allowurl and strstr($message,'[url]')) {
eval("standarderror(\"".gettemplate("error_nourlallowed")."\");");
exit;
}
}
Make sure you change the $allowurl amount to suit your site.
Again, I am very surprised that you have staff members who do not reach the minimum post count for your site. :)
Graphics
10-19-2002, 05:22 PM
hey erwin cna u make it for ".com" also. and if u can a lot of ppl use the vbcode [url ] is there a way to make it into that also.
i am just asking if u can. if not its still a great hack.
Erwin
10-19-2002, 08:58 PM
Originally posted by Graphics
hey erwin cna u make it for ".com" also. and if u can a lot of ppl use the vbcode [url ] is there a way to make it into that also.
i am just asking if u can. if not its still a great hack.
If they only put in a ".com" then the domain will show but it won't be linkable. People will have to type it out.
If they use the vcode [url ] this hack will block it automatically.
Dark Shogun
10-21-2002, 06:05 PM
Originally posted by Erwin
Your staff have less than the minimum post count required???
Again, I am very surprised that you have staff members who do not reach the minimum post count for your site. :)
It is because my forum is new. :)
Dark Shogun
Erwin
10-21-2002, 07:24 PM
Update: Version 1.1 - fixed up a loophole. Just replace the old code with the new.
I've discovered a couple of loopholes that new users can use to post URLs. I've replaced the old code with a new piece of code that closes up these loopholes. Please download the 1.1 version of the text file, and replace the old code with the new. :)
HHTKAO
10-27-2002, 02:56 AM
Is step one and two the same for a reason?
Erwin
10-27-2002, 02:03 AM
Step One is for newthread.php, Step Two is for newreply.php - different files, but same code to find and add.
smess
10-27-2002, 04:34 AM
works great, thanks a lot.
Dean C
10-27-2002, 03:18 PM
Awesome this should be quite easy to modify for a specific forum :D
Thanks Erwin :D
Regards
- miSt
Brain Crusher
02-17-2003, 10:38 PM
The Hack is bugy, if a guy want promotion his homepage
he can make a post like
subject my page
text: rotten.com
and post it after it, he can edit his own post and make rotten.com to www.rotten.com, after submit it
the link will be active with "[URL]"...
Brain Crusher
02-17-2003, 11:00 PM
Helped myself :).
I think you should add this to editpost.php under the same "find string" how newreply.php
$allowurl = 15;
if($bbuserinfo[posts] < $allowurl and strstr($message,'[url')) {
eval("standarderror(\"".gettemplate("error_nourlallowed")."\");");
exit;
}
if($bbuserinfo[posts] < $allowurl and strstr($message,'[URL')) {
eval("standarderror(\"".gettemplate("error_nourlallowed")."\");");
exit;
}
$allowurl = 15;
if($bbuserinfo[posts] < $allowurl and strstr($message,'www')) {
eval("standarderror(\"".gettemplate("error_nourlallowed")."\");");
exit;
}
if($bbuserinfo[posts] < $allowurl and strstr($message,'www')) {
eval("standarderror(\"".gettemplate("error_nourlallowed")."\");");
exit;
}
which blocks now also to edit the www or URL-BBcode to the url.
Nice hack.
I would recommend you use the stristr function instead of the strstr function.
You might also want to "streamline" it into one condition:if( ($bbuserinfo[posts] < $allowurl) and (stristr($message,'[url') or stristr($message,'www.') or stristr($message,'http://')) ) {with the added http:// check. (http://google.com)
sajjid
05-16-2003, 11:34 PM
i was wondering if it is possiable to disable live linking i mean users be able to post a link but it should not be clickable.
i dont mind people posting links as long as they not clickable other should be able to see it then if they wanna visit that site then they have to type it in thier browser. Just like my signature below
Erwin
05-17-2003, 12:22 AM
Update Version 2.0 - Tidied up the code, added to editpost.php, made it easier to change the variable
Just download the text file and replace the old code. I've made it so you can change the minimum post easily in the phpinclude template.
Erwin
05-17-2003, 12:24 AM
Today at 10:34 AM sajjid said this in Post #27 (https://vborg.vbsupport.ru/showthread.php?postid=395927#post395927)
i was wondering if it is possiable to disable live linking i mean users be able to post a link but it should not be clickable.
i dont mind people posting links as long as they not clickable other should be able to see it then if they wanna visit that site then they have to type it in thier browser. Just like my signature below
That would require an edit of functions.php, and not the purpose of this hack. It's a matter of making the "automatically parse URL" radio button switched to off automatically.
sajjid
05-17-2003, 01:24 AM
Thanks for the quick reply but i am still lost i am new to php coding
any further help would be most welcome
tkeil69575
06-22-2003, 03:04 PM
great hack erwin
thank you
David Bott
07-24-2003, 02:01 PM
I am sorry to say I am at a total loss on this one. It is weird...If I add the code to the two of the files (editpost.php and newreply.php)...they all produce...
Parse error: parse error in /home/avsforum/www.avsforum.com/avs-vb/editpost.php on line 307
...or the like. In this case, line 307 is the last line in the file.
This is a great hack and needed on AVS Forum...I just can not seem to figure out why this is happening. ver 2.2.8
Help?
David Bott
07-24-2003, 02:24 PM
NOTE....In your instructions for editpost.php and newreply.php you have forgot your closing } for the IF statment. Thus the above error.
Erwin
07-25-2003, 02:49 AM
You're right... how embarassing... :) It's been almost a year as well... thanks - text file fixed.
David Bott
07-25-2003, 11:11 AM
Yes...A year...LOL. Your hacks still live on! ;) This is a great one in my book.
Thanks for all you do.
partang2
07-30-2003, 01:32 PM
I installed it today on 2.3.0 and it doesn't work at all there....
jdmuniverse
08-06-2003, 04:03 PM
* jdmuniverse jumps up and hits the install button with a bat :)
bigdaddy04
01-17-2004, 11:33 PM
Does this hack also disable urls in the signatures/pms?
MickDoneDee
07-02-2004, 07:10 AM
Does this hack also disable urls in the signatures/pms?
I'd install this if it was ported to vB3.x.x. If anyone here has it running on their site how effectively has it helped to reduce spamming?
Battle_Ring
08-02-2004, 11:43 PM
Works Great! I Installed on 2.3.5
trulylowcarb
03-22-2005, 06:46 AM
I'm looking for something llike this that works for 3.0 .... and would like to disallow links in sigs completely .... can't believe it doesn't exist...
Erwin, I have installed and enjoyed other hacks of yours that were for 3.0 - [[thanks!! esp. for the PM quick reply]] Any chance you have a version of this hack working in 3.0 and I've just missed it somehow?
RS25com
08-10-2005, 05:53 PM
Bump - any chance of a 3.0 version of this?
wolfyman
08-15-2005, 12:08 PM
or a 3.5 :D
Hi,
Has anyone got a 3.5 solution to this ?
cheers.
wolfyman
10-09-2005, 11:03 PM
<a href="https://vborg.vbsupport.ru/showthread.php?t=96018" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=96018</a>
steveprice
10-09-2006, 02:08 PM
Hi
This is a terrific hack. I was getting over 100 spam posts a day, and this stopped them dead in their tracks. The spammers do everything automatically, so you don't really have to worry about them slipping a post by the moderators and then editing it later - too much bother for them.
On my sites, I do get lots of posts from people who want to show images of things for evaluation, so I edited out the blocks to the strings, "www." and "http". I just block anything with "[url" or "[URL" from a new user. Since the software automatically appends that to any URL that starts with http:// or with www., but not to things that start with [img], it lets through the stuff I want to let through, blocks the trash.
Many, many thanks.
steveprice
10-11-2006, 12:09 PM
Hi Again
Just discovered a glitch. It works perfectly with new threads and with new replies. But, new replies can no longer be previewed. The "Preview" button acts just like another "Post Reply" button. It also truncates the user name to "by" on the forum index page. This happens with users with hundreds of posts, not just newbies.
Any help you can offer on this would be very welcome.
Thanks.
Added Note: I'm using vBulletin v. 2.2.6
Moria123
01-26-2007, 06:07 PM
Is there a way you could get this to work for a specific forum only?
So they would have to post X times in that specific forum before being allowed to post a link rather than the boards as a whole?
dealxa
09-27-2007, 10:37 AM
i'm using vbulletin 3.6.8 and your codes didn't find in editpost.php, newreply.php and newthread.php?????
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.