diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-07-06 11:41:08 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-07-06 11:41:08 +0800 |
commit | bf006bc9653ae3e621486c56f9892841b49bf5d7 (patch) | |
tree | e47ca8993a630cbc8da41183c45409de038d78cd /mbbsd/announce.c | |
parent | 282b585f4f217d84007144877810b70ba2c6dd79 (diff) | |
download | pttbbs-bf006bc9653ae3e621486c56f9892841b49bf5d7.tar pttbbs-bf006bc9653ae3e621486c56f9892841b49bf5d7.tar.gz pttbbs-bf006bc9653ae3e621486c56f9892841b49bf5d7.tar.bz2 pttbbs-bf006bc9653ae3e621486c56f9892841b49bf5d7.tar.lz pttbbs-bf006bc9653ae3e621486c56f9892841b49bf5d7.tar.xz pttbbs-bf006bc9653ae3e621486c56f9892841b49bf5d7.tar.zst pttbbs-bf006bc9653ae3e621486c56f9892841b49bf5d7.zip |
delete blog comments from mbbsd
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1032 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/announce.c')
-rw-r--r-- | mbbsd/announce.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/mbbsd/announce.c b/mbbsd/announce.c index b0130d92..f0db7535 100644 --- a/mbbsd/announce.c +++ b/mbbsd/announce.c @@ -1,4 +1,4 @@ -/* $Id: announce.c,v 1.29 2003/06/28 09:27:15 kcwu Exp $ */ +/* $Id: announce.c,v 1.30 2003/07/06 03:41:08 in2 Exp $ */ #include "bbs.h" #define PATHLEN 256 @@ -1079,6 +1079,7 @@ Announce() } #ifdef BLOG +#include <mysql/mysql.h> void BlogMain(int num) { int oldmode = currutmp->mode; @@ -1099,7 +1100,9 @@ void BlogMain(int num) " 只在部落格資料整個亂掉的時候才使用\n" "\n" "3.將本文加入部落格\n" - " 將游標所在位置的文章加入部落格\n"); + " 將游標所在位置的文章加入部落格\n" + "\n" + "4.刪除迴響\n"); switch( getans("請選擇(0-3)?[0]") ){ case '1': snprintf(genbuf, sizeof(genbuf), @@ -1117,6 +1120,38 @@ void BlogMain(int num) "bin/builddb.pl -f -n %d %s", num, currboard); system(genbuf); break; + case '4':{ + char hash[35]; + getdata(16, 0, "請輸入該篇的雜湊值: ", + hash, sizeof(hash), DOECHO); + if( hash[0] != 0 && + getans("請確定刪除(Y/N)?[N] ") == 'y' ){ + MYSQL mysql; + char cmd[256]; + + sprintf(cmd, "delete from comment where " + "hash='%s'&&brdname='%s'", hash, currboard); +#ifdef DEBUG + vmsg(cmd); +#endif + if( !(!mysql_init(&mysql) || + !mysql_real_connect(&mysql, BLOGDB_HOST, BLOGDB_USER, + BLOGDB_PASSWD, BLOGDB_DB, + BLOGDB_PORT, BLOGDB_SOCK, 0) || + mysql_query(&mysql, cmd)) ) + vmsg("資料刪除完成"); + else + vmsg( +#ifdef DEBUG + mysql_error(&mysql) +#else + "database internal error" +#endif + ); + mysql_close(&mysql); + } + } + break; default: exit = 1; break; |