summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-06-02 13:34:57 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-06-02 13:34:57 +0800
commitd27183540fee8c1a21f73d0582b1fef5eba4fcd1 (patch)
treef311d6e3485fb7787053ff5e00fa584a36b85265
parent9c0c3379944ab2a8dd3b17f0bcf597f2168d5177 (diff)
downloadpttbbs-d27183540fee8c1a21f73d0582b1fef5eba4fcd1.tar
pttbbs-d27183540fee8c1a21f73d0582b1fef5eba4fcd1.tar.gz
pttbbs-d27183540fee8c1a21f73d0582b1fef5eba4fcd1.tar.bz2
pttbbs-d27183540fee8c1a21f73d0582b1fef5eba4fcd1.tar.lz
pttbbs-d27183540fee8c1a21f73d0582b1fef5eba4fcd1.tar.xz
pttbbs-d27183540fee8c1a21f73d0582b1fef5eba4fcd1.tar.zst
pttbbs-d27183540fee8c1a21f73d0582b1fef5eba4fcd1.zip
anti flooding counter
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@922 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rwxr-xr-xpttbbs/blog/blog.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/pttbbs/blog/blog.pl b/pttbbs/blog/blog.pl
index ccfeb5c3..ab8b4aa9 100755
--- a/pttbbs/blog/blog.pl
+++ b/pttbbs/blog/blog.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: blog.pl,v 1.14 2003/06/02 03:39:24 in2 Exp $
+# $Id: blog.pl,v 1.15 2003/06/02 05:34:57 in2 Exp $
use CGI qw/:standard/;
use lib qw/./;
use LocalVars;
@@ -131,8 +131,10 @@ sub main
if( $attr{"$fn.loadCounter"} ){
$th{counter} = dodbi(sub {
my($dbh) = @_;
- my($sth, $t);
- $dbh->do("update counter set v = v + 1 where k = '$brdname'");
+ my($sth, $t, $time);
+ $time = time();
+ $dbh->do("update counter set v = v + 1, mtime = $time ".
+ "where k = '$brdname' && mtime < ". ($time - 2));
$sth = $dbh->prepare("select v from counter where k='$brdname'");
$sth->execute();
$t = $sth->fetchrow_hashref();