From 5f36f8a8fb4424a5b75f6c2e478a4a398ec1492a Mon Sep 17 00:00:00 2001 From: kcwu Date: Sat, 16 Sep 2006 18:41:39 +0000 Subject: deny abuse of recommendation, don't recommend too frequently. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3413 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbs.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mbbsd') diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 1775b03d..9e4f7e5b 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -2230,6 +2230,20 @@ recommend(int ent, fileheader_t * fhdr, const char *direct) return FULLUPDATE; } } + { + static unsigned char lastrecommend_minute = 0; + static unsigned short recommend_in_minute = 0; + unsigned char now_in_minute = (unsigned char)(now / 60); + if(now_in_minute != lastrecommend_minute) { + recommend_in_minute = 0; + lastrecommend_minute = now_in_minute; + } + recommend_in_minute++; + if(recommend_in_minute>60) { + vmsg("系統禁止短時間內大量推文"); + return FULLUPDATE; + } + } #ifdef USE_COOLDOWN if(check_cooldown(bp)) -- cgit v1.2.3