diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-07-06 11:56:38 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-07-06 11:56:38 +0800 |
commit | aa6a1eafd5598811cb0fc36f28be14bff830c41c (patch) | |
tree | 1f95ab1b64d629f19de4e4a27099cf50d859ed22 /blog | |
parent | bf006bc9653ae3e621486c56f9892841b49bf5d7 (diff) | |
download | pttbbs-aa6a1eafd5598811cb0fc36f28be14bff830c41c.tar pttbbs-aa6a1eafd5598811cb0fc36f28be14bff830c41c.tar.gz pttbbs-aa6a1eafd5598811cb0fc36f28be14bff830c41c.tar.bz2 pttbbs-aa6a1eafd5598811cb0fc36f28be14bff830c41c.tar.lz pttbbs-aa6a1eafd5598811cb0fc36f28be14bff830c41c.tar.xz pttbbs-aa6a1eafd5598811cb0fc36f28be14bff830c41c.tar.zst pttbbs-aa6a1eafd5598811cb0fc36f28be14bff830c41c.zip |
for deleting, add hash
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1033 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'blog')
-rwxr-xr-x | blog/blog.pl | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/blog/blog.pl b/blog/blog.pl index 78885190..838fa676 100755 --- a/blog/blog.pl +++ b/blog/blog.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: blog.pl,v 1.27 2003/07/05 09:58:53 in2 Exp $ +# $Id: blog.pl,v 1.28 2003/07/06 03:56:38 in2 Exp $ use CGI qw/:standard/; use lib qw/./; use LocalVars; @@ -13,6 +13,7 @@ use OurNet::FuzzyIndex; use DBI; use DBD::mysql; use POSIX; +use MD5; use vars qw/@emonth @cnumber %config %attr %article %th $dbh $brdname/; @@ -252,16 +253,20 @@ sub main if( $name && $comment ){ dodbi(sub { my($dbh) = @_; - $dbh->do("insert into comment (brdname, artid, name, mail, ". - "content, mtime) values ('$brdname', '$th{key}', ". - "'$name', '$mail', '$comment', ". time(). ")"); + my($t, $hash); + $t = time(); + $hash = MD5->hexhash("$t$th{key}$name$mail$comment"); + $dbh->do('insert into comment '. + '(brdname, artid, name, mail, content, mtime, hash) '. + "values ('$brdname', '$th{key}', '$name', '$mail', ". + "'$comment', '$t', '$hash')"); }); } dodbi(sub { my($dbh) = @_; my($sth, $t); - $sth = $dbh->prepare("select mtime,name,mail,content ". + $sth = $dbh->prepare("select mtime,name,mail,content,hash ". "from comment ". "where brdname='$brdname'&&artid='$th{key}' ". "order by mtime desc"); |