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 | |
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')
-rw-r--r-- | mbbsd/Makefile | 7 | ||||
-rw-r--r-- | mbbsd/announce.c | 39 |
2 files changed, 43 insertions, 3 deletions
diff --git a/mbbsd/Makefile b/mbbsd/Makefile index a8ebd584..7d16b04f 100644 --- a/mbbsd/Makefile +++ b/mbbsd/Makefile @@ -1,7 +1,12 @@ -# $Id: Makefile,v 1.27 2003/06/28 08:55:40 kcwu Exp $ +# $Id: Makefile,v 1.28 2003/07/06 03:41:08 in2 Exp $ .include "../pttbbs.mk" +.if defined(WITH_BLOG) +CFLAGS+= -I/usr/local/include -DBLOG +LDFLAGS+= -L/usr/local/lib/mysql -lmysqlclient +.endif + PROG= mbbsd OBJS= admin.o announce.o args.o bbs.o board.o cache.o cal.o card.o\ chat.o chc_draw.o chc_net.o chc_play.o chc_rule.o chicken.o dark.o\ 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; |