summaryrefslogtreecommitdiffstats
path: root/blog
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
commite78ada9ed9198b40e57a6ad31062e07578ae81e8 (patch)
tree43244985d85d61e82650f734cb77fcd7b86c2574 /blog
parent993edac13d652c81acb95eb8d08a589124dc44fe (diff)
downloadpttbbs-e78ada9ed9198b40e57a6ad31062e07578ae81e8.tar
pttbbs-e78ada9ed9198b40e57a6ad31062e07578ae81e8.tar.gz
pttbbs-e78ada9ed9198b40e57a6ad31062e07578ae81e8.tar.bz2
pttbbs-e78ada9ed9198b40e57a6ad31062e07578ae81e8.tar.lz
pttbbs-e78ada9ed9198b40e57a6ad31062e07578ae81e8.tar.xz
pttbbs-e78ada9ed9198b40e57a6ad31062e07578ae81e8.tar.zst
pttbbs-e78ada9ed9198b40e57a6ad31062e07578ae81e8.zip
anti flooding counter
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@922 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'blog')
-rwxr-xr-xblog/blog.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/blog/blog.pl b/blog/blog.pl
index ccfeb5c3..ab8b4aa9 100755
--- a/blog/blog.pl
+++ b/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();