vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Anti-spam post decrementer (https://vborg.vbsupport.ru/showthread.php?t=41112)

Kier 07-15-2002 09:00 PM

Anti-spam post decrementer
 
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:
Code:

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

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

".iif ($foruminfo[countposts],"posts=posts+1,","")."
and replace with this:
Code:

".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 09:11 PM

Odd little hack, but it is nice to have fun with your members every now and then :).

- SaintDog

Brad 07-15-2002 09:54 PM

i smell a late april 1st :p, love the hack ^_^

Link14716 07-15-2002 10:05 PM

not a particulaly useful hack, but fun to screw around with :-P

Kier 07-15-2002 10:08 PM

Quote:

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 10:17 PM

rolf this is great, Im going to install it to bug all my troll members! hahaha, awesome :D

Neo 07-16-2002 12:20 AM

LOL, nice one Kier.

JulianD 07-16-2002 06:14 AM

Looks very funny hehehe

Boofo 07-16-2002 08: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 09:37 AM

Quote:

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:
[sql]ALTER TABLE user CHANGE posts posts SMALLINT DEFAULT 0 NOT NULL;[/sql]

Raz 07-16-2002 10:45 AM

Quote:

Originally posted by FireFly

It will not go below 0. If you want it to, run this query:
[sql]ALTER TABLE user CHANGE posts posts SMALLINT DEFAULT 0 NOT NULL;[/sql]

Remember, doing this will reduce your very maximum post count to 32767.

Boofo 07-16-2002 11:02 AM

Where is LongINT when you need it? :)

Quote:

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

Admin 07-16-2002 11:08 AM

Quote:

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...
[sql]ALTER TABLE user CHANGE posts posts MEDIUMINT DEFAULT 0 NOT NULL;[/sql]

Boofo 07-16-2002 11:18 AM

Which will do what? :)

Admin 07-16-2002 11:30 AM

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 11:37 AM

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.) :)

Quote:

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 04: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 02:52 AM

I'd like to install this hack, but I have one problem with it.
In my newreply.php, it says:

Quote:

".iif ($foruminfo[countposts],"posts=posts+1,storep=storep+'$fool',","")."
I can't seem to get it right when trying to change this one.


All times are GMT. The time now is 11:17 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03728 seconds
  • Memory Usage 1,750KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (18)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete