PDA

View Full Version : Anti-spam post decrementer


Kier
07-15-2002, 10:00 PM
This is a bit of a silly hack, but a few of my moderators wanted it, so I thought I'd share it with you people.

What it does is when a user posts, the system checks against a list of user IDs, and if the user is in that list, their post count goes down by one, rather than going up by one post. Very silly I know, but anyway...

1) run the following query:INSERT INTO setting (settinggroupid, title, varname, description, displayorder) VALUES
(6, 'Users with inverse post counters', 'decrementusers',
'Users in this list will have their post count decremented when they post. Separate user IDs with a comma', 100)
2) in functions.php, add the following code somewhere near the bottom of the file:function incrementposts($userid) {
static $decrementusers;
if (!is_array($decrementusers)) {
$decrementusers = explode(',', $GLOBALS['decrementusers']);
}
if (in_array($userid, $decrementusers)) {
return 'posts=posts-1,';
} else {
return 'posts=posts+1,';
}
}
3) in newreply.php and newthread.php, find this code:".iif ($foruminfo[countposts],"posts=posts+1,","")."and replace with this:".iif ($foruminfo[countposts], incrementposts($bbuserinfo['userid']), '')."
Then go into your control panel and edit the new setting, inserting something like 1001,2544 to set users 1001 and 2544 to have inverse post counters.

Have fun :classic:

SaintDog
07-15-2002, 10:11 PM
Odd little hack, but it is nice to have fun with your members every now and then :).

- SaintDog

Brad
07-15-2002, 10:54 PM
i smell a late april 1st :p, love the hack ^_^

Link14716
07-15-2002, 11:05 PM
not a particulaly useful hack, but fun to screw around with :-P

Kier
07-15-2002, 11:08 PM
Originally posted by Link14716
not a particulaly useful hack, but fun to screw around with :-P I don't remember saying it was useful :p

snyx
07-15-2002, 11:17 PM
rolf this is great, Im going to install it to bug all my troll members! hahaha, awesome :D

Neo
07-16-2002, 01:20 AM
LOL, nice one Kier.

JulianD
07-16-2002, 07:14 AM
Looks very funny hehehe

Boofo
07-16-2002, 09:41 AM
What if a user gets down to 0? Will it start counting -1, -2 and so on? Or will it stop at 1? :)

Admin
07-16-2002, 10:37 AM
Originally posted by Boofo
What if a user gets down to 0? Will it start counting -1, -2 and so on? Or will it stop at 1? :)
It will not go below 0. If you want it to, run this query:
ALTER TABLE user CHANGE posts posts SMALLINT DEFAULT 0 NOT NULL;

Raz
07-16-2002, 11:45 AM
Originally posted by FireFly

It will not go below 0. If you want it to, run this query:
ALTER TABLE user CHANGE posts posts SMALLINT DEFAULT 0 NOT NULL; Remember, doing this will reduce your very maximum post count to 32767.

Boofo
07-16-2002, 12:02 PM
Where is LongINT when you need it? :)

Originally posted by Raz
Remember, doing this will reduce your very maximum post count to 32767.

Admin
07-16-2002, 12:08 PM
Originally posted by Raz
Remember, doing this will reduce your very maximum post count to 32767.
True, heh, if you have spamme- err active posters use this...
ALTER TABLE user CHANGE posts posts MEDIUMINT DEFAULT 0 NOT NULL;

Boofo
07-16-2002, 12:18 PM
Which will do what? :)

Admin
07-16-2002, 12:30 PM
If you don't have any users with more than 32,000 posts, use the first one. If you do, use the second one.

Boofo
07-16-2002, 12:37 PM
I don't have very many users with 32 posts let alone 32,000 posts. I think I'll be safe with the first one (for now, anyway.) :)

Originally posted by FireFly
If you don't have any users with more than 32,000 posts, use the first one. If you do, use the second one.

trilOByte
07-25-2002, 05:53 PM
What would be very cool, is if somehow this hack could be tied into the posting timelimit. If a user posts more than XX seconds apart, then the post count increments, if less than XX seconds, then the post count decrements. We have some *very* prolific posters who tend to spam threads a lot, but we don't want to penalise regular users with a 90 second posting limit.

Leah
04-19-2003, 03:52 AM
I'd like to install this hack, but I have one problem with it.
In my newreply.php, it says:

".iif ($foruminfo[countposts],"posts=posts+1,storep=storep+'$fool',","")."

I can't seem to get it right when trying to change this one.