ForumMSGAdmin.java
上传用户:yuyunping
上传日期:2013-03-21
资源大小:1844k
文件大小:20k
源码类别:

Java书籍

开发平台:

Java

  1. package net.acai.forum.admin;
  2. /**
  3.  * Title:        清清网络
  4.  * Description:
  5.  * Copyright:    Copyright (c) 2002
  6.  * Company:      www.SuperSpace.com
  7.  * @author:       SuperSpace
  8.  * @version 1.0
  9.  */
  10. import net.acai.forum.*;
  11. import net.acai.database.*;
  12. import javax.servlet.http.*;
  13. import java.sql.*;
  14. import net.acai.util.*;
  15. public class ForumMSGAdmin
  16. { int forumID,rootID,announceID;
  17. String userName,sql,url,action;
  18. User theUser;
  19. public ForumMSGAdmin(){
  20. }
  21. public ForumMSGAdmin(HttpServletRequest request,HttpServletResponse response) throws Exception{
  22. userName=GCookie.getCookieValue(request,"UJBBUName","");
  23. theUser=SkinUtil.checkUser(request,response,4);
  24. checkAdmin(request,response);
  25. adminMSG(request,response);
  26. }
  27. public void checkAdmin(HttpServletRequest request,HttpServletResponse response) throws Exception{
  28. action=ParamUtil.getString(request,"action");
  29. if(action==null||"".equals(action))
  30. throw new Exception("错误请求!");
  31. forumID=ParamUtil.getInt(request,"forumID");
  32. if(!action.equals("delall")){
  33. rootID=ParamUtil.getInt(request,"rootID");
  34. announceID=ParamUtil.getInt(request,"announceID");
  35. }
  36. if(forumID==0)
  37. throw new Exception("请指定论坛版面");
  38. Forum theForum=new Forum(forumID);
  39. if(theForum==null||(theForum.getForumMaster().indexOf(userName)<0&&theUser.getUserClass()<20))
  40. throw new Exception("您不是该版面斑竹或者系统管理员。");
  41. }
  42. public void adminMSG(HttpServletRequest request,HttpServletResponse response) throws Exception{
  43. if (action.equals("lock"))
  44.  lockMSG();
  45. else if (action.equals("unlock"))
  46.  unlockMSG();
  47. else if (action.equals("deltopic"))
  48.  delTopic();
  49. else if (action.equals("move")){
  50. String tempString=ParamUtil.getString(request,"checked");
  51. if(tempString!=null&&"yes".equals(tempString))
  52. moveTopic(request);
  53. else
  54. return;
  55. }
  56. else if (action.equals("delall")){
  57. String tempString=ParamUtil.getString(request,"checked");
  58. if(tempString!=null&&"yes".equals(tempString))
  59. delAll(request);
  60. else
  61. return;
  62. }
  63. else if (action.equals("copy")){
  64. String tempString=ParamUtil.getString(request,"checked");
  65. if(tempString!=null&&"yes".equals(tempString))
  66. copyTopic(request);
  67. }
  68. else if (action.equals("top"))
  69.  topMSG();
  70. else if (action.equals("untop"))
  71.  untopMSG();
  72. else if (action.equals("delmsg" ))
  73.  delMSG();
  74. else if (action.equals("isbest"))
  75.  bestMSG();
  76. else if (action.equals("nobest" ))
  77.  unbestMSG();
  78. else
  79. throw new Exception ("请选择相应操作。");
  80. }
  81. public void  delAll(HttpServletRequest request) throws Exception{
  82. String username=ParamUtil.getString(request,"username");
  83. if(username==null||"".equals(username))
  84. throw new Exception("请输入被帖子删除用户名。");
  85. DBConnect dbc=new DBConnect();
  86. sql="Select Count(announceID) from bbs.bbs1 where boardID="+forumID+" and username=?";
  87. dbc.prepareStatement(sql);
  88. dbc.setBytes(1,(new String(username.getBytes("ISO-8859-1"),"GBK")).getBytes());
  89. ResultSet rs=dbc.executeQuery();
  90. rs.next();
  91. int titlenum=rs.getInt(1);
  92.      rs.close();
  93. if(titlenum!=0){
  94. int wealthDel=Integer.parseInt(ForumPropertiesManager.getString("wealthDel"));
  95. int epDel=Integer.parseInt(ForumPropertiesManager.getString("epDel"));
  96. int cpDel=Integer.parseInt(ForumPropertiesManager.getString("cpDel"));
  97. sql="update bbs.bbs1 set locktopic=2 where boardID="+forumID+" and  username=?";
  98. dbc.prepareStatement(sql);
  99. dbc.setBytes(1,(new String(username.getBytes("ISO-8859-1"),"GBK")).getBytes());
  100. dbc.executeUpdate();
  101. sql="update bbs.myuser set article=article-"+titlenum+",userWealth=userWealth-"+(titlenum*wealthDel)+",userEP=userEP-"+(titlenum*epDel)+",userCP=userCP-"+(titlenum*cpDel)+" where username=?";
  102. dbc.prepareStatement(sql);
  103. dbc.setBytes(1,(new String(username.getBytes("ISO-8859-1"),"GBK")).getBytes());
  104. dbc.executeUpdate();
  105. sql="select count(announceid) from bbs.bbs1 where boardID="+forumID;
  106. rs=dbc.executeQuery(sql);
  107. rs.next();
  108. int NewAnnounceNum=rs.getInt(1);
  109. rs.close();
  110. sql="select count(announceid) from bbs.bbs1 where ParentID=0 and boardID="+forumID;
  111. rs=dbc.executeQuery(sql);
  112. rs.next();
  113. int NewTopicNum=rs.getInt(1);
  114. rs.close();
  115. sql="update bbs.board set lastbbsnum="+NewAnnounceNum+",lasttopicnum="+NewTopicNum+" where boardID="+forumID;
  116. dbc.executeUpdate();
  117. }
  118. dbc.close();
  119. }
  120. public void copyTopic(HttpServletRequest request) throws Exception{
  121. int newForumID=ParamUtil.getInt(request,"newForumID");
  122. DBConnect dbc=new DBConnect();
  123. ResultSet rs;
  124. if (forumID==newForumID){
  125. dbc.close();
  126. throw new Exception("不能在相同版面内进行转移操作。");
  127. }
  128. else{
  129. sql="select boardID,announceid,Parentid from bbs.bbs1 where announceid="+announceID+" and boardID="+forumID;
  130. dbc.prepareStatement(sql);
  131. rs=dbc.executeQuery();
  132. if(!rs.next()){
  133. dbc.close();
  134. throw new Exception ("您选择的贴子并不存在。");
  135. }
  136. else {
  137. //rs.next();
  138. if(rs.getInt(3)!=0){
  139. dbc.close();
  140. throw new Exception("您必须选择一个主题,而不是贴子。");
  141. }
  142. }
  143. }
  144. String  newtopic,username,body,dateandtime,ip,Expression;
  145. int msgLength, announceid;
  146. sql="select topic,username,body,dateAndTime,length,ip,Expression from bbs.bbs1 where announceid="+announceID;
  147. rs=dbc.executeQuery(sql);
  148. if(!rs.next()){
  149. dbc.close();
  150. throw new Exception("没有此贴!");
  151. }
  152. //rs.next();
  153. newtopic=rs.getString(1) + "-->" + userName + "添加";
  154. username=rs.getString(2);
  155. body=rs.getString(3);
  156. dateandtime=rs.getString(4);
  157. msgLength=rs.getInt(5);
  158. ip=rs.getString(6);
  159. Expression=rs.getString(7);
  160. rs.close();
  161. sql="insert into bbs.bbs1(boardID,parentID,child,userName,topic,n body,dateandtime,hits,length,rootID,layer,orders,ip,Expression,locktopic,signflag,emailflag,times,isvote,istop,isbest) n values("+newForumID+",0,0,?,?,?,'"+dateandtime+"', 0,"+msgLength+",0,1,0,'"+ip+"','"+Expression+"',n 0,0,0,0,0,0,0)";
  162. dbc.prepareStatement(sql);
  163. dbc.setBytes(1,(new String(username.getBytes("ISO-8859-1"),"GBK")).getBytes());
  164. dbc.setBytes(2,(new String(newtopic.getBytes("ISO-8859-1"),"GBK")).getBytes());
  165. dbc.setBytes(3,(new String(body.getBytes("ISO-8859-1"),"GBK")).getBytes());
  166. dbc.executeUpdate();
  167. sql="select announceID from bbs.bbs1 order by announceID desc";
  168. rs=dbc.executeQuery(sql);
  169. rs.next();
  170. announceid=rs.getInt(1);
  171. rs.close();
  172. sql="update bbs.bbs1 set rootID="+announceid+",times="+announceid+" where announceID="+announceid;
  173. dbc.executeUpdate(sql);
  174. int postNum,todayNum;
  175. sql="select count(*) from bbs.bbs1 where rootID="+rootID;
  176. dbc.prepareStatement(sql);
  177. rs=dbc.executeQuery();
  178. rs.next();
  179. postNum=rs.getInt(1);
  180. rs.close();
  181. sql="select count(*) from bbs.bbs1 where rootID="+rootID+" and day(dateandtime)=day(getdate())";
  182. rs=dbc.executeQuery(sql);
  183. rs.next();
  184. todayNum=rs.getInt(1);
  185. rs.close();
  186. //'更新论坛贴子数据
  187. //LastCount(forumID)
  188. //LastCount(newForumID)
  189. //call BoardNumAdd(newForumID,1,postNum,todayNum)
  190. //call AllboardNumAdd(todayNum,postNum,1)
  191. lastCount(forumID);
  192. lastCount(newForumID);
  193. forumNumAdd(newForumID,0,1,todayNum,dbc);
  194. allForumNumAdd(todayNum,1,0,dbc);
  195. url="dispbbs.jsp?forumID="+newForumID+"&rootID="+announceid+"&announceID="+announceid;
  196. sql="insert into bbs.log (l_username,l_content,l_url) values (?,?,'"+url+"')";
  197. dbc.prepareStatement(sql);
  198. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  199. dbc.setBytes(2,(new String("拷贝帖子".getBytes("ISO-8859-1"),"GBK")).getBytes());
  200. dbc.executeUpdate();
  201. dbc.close();
  202. ForumPropertiesManager.resetManager();
  203. }
  204. public void moveTopic(HttpServletRequest request) throws Exception{
  205. int newForumID=ParamUtil.getInt(request,"newForumID");
  206. DBConnect dbc=new DBConnect();
  207. ResultSet rs;
  208. if (forumID==newForumID){
  209. dbc.close();
  210. throw new Exception("不能在相同版面内进行转移操作。");
  211. }
  212. else{
  213. sql="select boardID,announceid,Parentid from bbs.bbs1 where announceid="+announceID+" and boardID="+forumID;
  214. dbc.prepareStatement(sql);
  215. rs=dbc.executeQuery();
  216. if(!rs.next()){
  217. dbc.close();
  218. throw new Exception ("您选择的贴子并不存在。");
  219. }
  220. else {
  221. //rs.next();
  222. if(rs.getInt(3)!=0){
  223. dbc.close();
  224. throw new Exception("您必须选择一个主题,而不是贴子。");
  225. }
  226. }
  227. }
  228. String leavemessage=ParamUtil.getString(request,"leavemessage");
  229. if(leavemessage==null||leavemessage.equals("")){
  230. dbc.close();
  231. throw new Exception("请选择相应的操作!");
  232. }
  233. if (leavemessage.equals("yes")) {
  234. //'ON ERROR RESUME NEXT
  235. }
  236. else if (leavemessage.equals("no")) {
  237. String newtopic;
  238. sql="select topic from bbs.bbs1 where announceid="+rootID;
  239. dbc.prepareStatement(sql);
  240. rs=dbc.executeQuery();
  241. rs.next();
  242. newtopic=rs.getString(1)+ "-->" + userName + "转移";
  243. rs.close();
  244. sql="update bbs.bbs1 set topic=? where announceid="+rootID;
  245. dbc.prepareStatement(sql);
  246. dbc.setBytes(1,(new String(newtopic.getBytes("ISO-8859-1"),"GBK")).getBytes());
  247. dbc.executeUpdate();
  248. sql="update bbs.bbs1 set boardID="+newForumID+" where rootID="+rootID;
  249. dbc.prepareStatement(sql);
  250. dbc.executeUpdate();
  251. int postNum,todayNum;
  252. sql="select count(*) from bbs.bbs1 where rootID="+rootID;
  253. dbc.prepareStatement(sql);
  254. rs=dbc.executeQuery();
  255. rs.next();
  256. postNum=rs.getInt(1);
  257. rs.close();
  258. sql="select count(*) from bbs.bbs1 where rootID="+rootID+" and day(dateandtime)=day(getdate())";
  259. rs=dbc.executeQuery(sql);
  260. rs.next();
  261. todayNum=rs.getInt(1);
  262. rs.close();
  263. //'更新论坛贴子数据
  264. lastCount(forumID);
  265. forumNumSub(forumID,0,1,todayNum,dbc);
  266. lastCount(newForumID);
  267. forumNumAdd(newForumID,0,1,todayNum,dbc);
  268. //allForumNumSub(todayNum,1,0,dbc);
  269. //'更新论坛数据结束
  270. url="dispbbs.jsp?forumID="+newForumID+"&rootID="+rootID+"&announceID="+rootID;
  271. sql="insert into bbs.log (l_username,l_content,l_url) values (?,?,'"+url+"')";
  272. dbc.prepareStatement(sql);
  273. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  274. dbc.setBytes(2,(new String("转移主题".getBytes("ISO-8859-1"),"GBK")).getBytes());
  275. dbc.executeUpdate();
  276. dbc.close();
  277. ForumPropertiesManager.resetManager();
  278. }
  279. else{
  280. dbc.close();
  281. throw new Exception("请选择相应操作。");
  282. }
  283. }
  284. //public void copyMSG() throws Exception{}
  285. public void lockMSG() throws Exception{
  286. sql="update bbs.bbs1 set locktopic=1 where boardID="+forumID+" and rootID="+rootID;
  287. DBConnect dbc=new DBConnect();
  288. dbc.executeUpdate(sql);
  289. url="dispbbs.jsp?forumID="+forumID+"&rootID="+rootID+"&announceID="+rootID;
  290. sql="insert into bbs.log (l_username,l_content,l_url) values (?,?,'"+url+"')";
  291. dbc.prepareStatement(sql);
  292. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  293. dbc.setBytes(2,(new String("锁定帖子".getBytes("ISO-8859-1"),"GBK")).getBytes());
  294. dbc.executeUpdate();
  295. dbc.close();
  296. }
  297. public void unlockMSG() throws Exception{
  298. DBConnect dbc=new DBConnect();
  299. sql="update bbs.bbs1 set locktopic=0 where boardID="+forumID+" and rootID="+rootID;
  300. dbc.executeUpdate(sql);
  301. url="dispbbs.jsp?forumID="+forumID+"&rootID="+rootID+"&announceID="+rootID;
  302. sql="insert into bbs.log (l_username,l_content,l_url) values (?,?,'"+url+"')";
  303. dbc.prepareStatement(sql);
  304. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  305. dbc.setBytes(2,(new String("解除锁定".getBytes("ISO-8859-1"),"GBK")).getBytes());
  306. dbc.executeUpdate();
  307. dbc.close();
  308. }
  309. public void topMSG() throws Exception{
  310. DBConnect dbc=new DBConnect();
  311. sql="update bbs.bbs1 set istop=1 where boardID="+forumID+" and rootID="+rootID;
  312. dbc.executeUpdate(sql);
  313. url="dispbbs.jsp?forumID="+forumID+"&rootID="+rootID+"&announceID="+rootID;
  314. sql="insert into bbs.log (l_username,l_content,l_url) values (?,?,'"+url+"')";
  315. dbc.prepareStatement(sql);
  316. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  317. dbc.setBytes(2,(new String("固顶帖子".getBytes("ISO-8859-1"),"GBK")).getBytes());
  318. dbc.executeUpdate();
  319. dbc.close();
  320. }
  321. public void untopMSG() throws Exception{
  322. DBConnect dbc=new DBConnect();
  323. sql="update bbs.bbs1 set istop=0 where boardID="+forumID+" and rootID="+rootID;
  324. dbc.executeUpdate(sql);
  325. url="dispbbs.jsp?forumID="+forumID+"&rootID="+rootID+"&announceID="+rootID;
  326. sql="insert into bbs.log (l_username,l_content,l_url) values (?,?,'"+url+"')";
  327. dbc.prepareStatement(sql);
  328. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  329. dbc.setBytes(2,(new String("解除固顶".getBytes("ISO-8859-1"),"GBK")).getBytes());
  330. dbc.executeUpdate();
  331. dbc.close();
  332. }
  333. public void bestMSG() throws Exception{
  334. DBConnect dbc=new DBConnect();
  335. sql="update bbs.bbs1 set isbest=1 where boardID="+forumID+" and announceid="+announceID;
  336. dbc.executeUpdate(sql);
  337. url="showannounce.jsp?forumID="+forumID+"&rootID="+rootID+"&announceID="+announceID;
  338. sql="insert into bbs.log (l_username,l_content,l_url) values (?,?,'"+url+"')";
  339. dbc.prepareStatement(sql);
  340. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  341. dbc.setBytes(2,(new String("加入精华".getBytes("ISO-8859-1"),"GBK")).getBytes());
  342. dbc.executeUpdate();
  343. dbc.close();
  344. }
  345. public void unbestMSG() throws Exception{
  346. DBConnect dbc=new DBConnect();
  347. sql="update bbs.bbs1 set isbest=0 where boardID="+forumID+" and announceid="+announceID;
  348. dbc.executeUpdate(sql);
  349. url="showannounce.jsp?forumID="+forumID+"&rootID="+rootID+"&announceID="+announceID;
  350. sql="insert into bbs.log (l_username,l_content,l_url) values (?,?,'"+url+"')";
  351. dbc.prepareStatement(sql);
  352. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  353. dbc.setBytes(2,(new String("解除精华".getBytes("ISO-8859-1"),"GBK")).getBytes());
  354. dbc.executeUpdate();
  355. dbc.close();
  356. }
  357. public void delMSG() throws Exception{
  358. DBConnect dbc=new DBConnect();
  359. sql="update bbs.bbs1 set locktopic=2 where boardID="+forumID+" and ParentID!=0 and announceid="+announceID;
  360. dbc.executeUpdate(sql);
  361. sql="select Max(announceid) from bbs1 where  locktopic!=2 and rootID="+rootID+" and boardID="+forumID;
  362. ResultSet rs=dbc.executeQuery(sql);
  363. rs.next();
  364. int lastPostime=rs.getInt(1);
  365. rs.close();
  366. int todayNum;
  367. sql="select count(*) from bbs.bbs1 where announceid="+announceID+" and day(dateandtime)=day(getdate())";
  368. rs=dbc.executeQuery(sql);
  369. rs.next();
  370. todayNum=rs.getInt(1);
  371. rs.close();
  372. lastCount(forumID);
  373. forumNumSub(forumID,0,1,todayNum,dbc);
  374. allForumNumSub(todayNum,1,0,dbc);
  375. int wealthDel=Integer.parseInt(ForumPropertiesManager.getString("wealthDel"));
  376. int epDel=Integer.parseInt(ForumPropertiesManager.getString("epDel"));
  377. int cpDel=Integer.parseInt(ForumPropertiesManager.getString("cpDel"));
  378. sql="update bbs.bbs1 set times="+lastPostime+" where rootID="+rootID+" and boardID="+forumID;
  379. dbc.executeUpdate(sql);
  380. sql="update bbs.bbs1 set child=child-1 where announceid="+rootID+" and boardID="+forumID;
  381. dbc.executeUpdate(sql);
  382. sql="update bbs.myuser set article=article-1,userWealth=userWealth-"+wealthDel+",userEP=userEP-"+epDel+",userCP=userCP-"+cpDel+"  where username=?";
  383. dbc.prepareStatement(sql);
  384. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  385. dbc.executeUpdate();
  386. url="showannounce.jsp?forumID="+forumID+"&rootID="+rootID+"&announceID="+announceID;
  387. sql="insert into bbs.log (l_username,l_content,l_url) values (?,?,'"+url+"')";
  388. dbc.prepareStatement(sql);
  389. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  390. dbc.setBytes(2,(new String("删除帖子".getBytes("ISO-8859-1"),"GBK")).getBytes());
  391. dbc.executeUpdate();
  392. dbc.close();
  393. ForumPropertiesManager.resetManager();
  394. }
  395. public void delTopic() throws Exception{
  396. DBConnect dbc=new DBConnect();
  397. int todayNum,postNum;
  398. sql="select count(*) from bbs.bbs1 where rootID="+rootID;
  399. ResultSet  rs=dbc.executeQuery(sql);
  400. rs.next();
  401. postNum=rs.getInt(1);
  402. sql="select count(*) from bbs.bbs1 where rootID="+rootID+" and     day(dateandtime)=day(getdate())";
  403. rs=dbc.executeQuery(sql);
  404. rs.next();
  405. todayNum=rs.getInt(1);
  406. rs.close();
  407. int wealthDel=Integer.parseInt(ForumPropertiesManager.getString("wealthDel"));
  408. int epDel=Integer.parseInt(ForumPropertiesManager.getString("epDel"));
  409. int cpDel=Integer.parseInt(ForumPropertiesManager.getString("cpDel"));
  410. sql="select username from bbs.bbs1 where rootID="+rootID;
  411. rs=dbc.executeQuery(sql);
  412. while(rs.next()){
  413. String tempName=rs.getString(1);
  414. if(tempName!=null&&!"".equals(tempName)){
  415. sql="update bbs.myuser set article=article-1,userWealth=userWealth-"+wealthDel+",userEP=userEP-"+epDel+" where username=?";
  416. dbc.prepareStatement(sql);
  417. dbc.setBytes(1,(new String(tempName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  418. dbc.executeUpdate();
  419. }
  420. }
  421. rs.close();
  422. sql="update bbs.bbs1 set locktopic=2 where rootID="+rootID;
  423. dbc.executeUpdate(sql);
  424. lastCount(forumID);
  425. forumNumSub(forumID,1,postNum,todayNum,dbc);
  426. allForumNumSub(todayNum,postNum,1,dbc);
  427. url="dispbbs.jsp?forumID="+forumID+"&rootID="+rootID+"&announceID="+rootID;
  428. sql="insert into bbs.log (l_username,l_content,l_url) values (?,?,'"+url+"')";
  429. dbc.prepareStatement(sql);
  430. dbc.setBytes(1,(new String(userName.getBytes("ISO-8859-1"),"GBK")).getBytes());
  431. dbc.setBytes(2,(new String("删除主题".getBytes("ISO-8859-1"),"GBK")).getBytes());
  432. dbc.executeUpdate();
  433. dbc.close();
  434. ForumPropertiesManager.resetManager();
  435. }
  436. public void lastCount(int forumID) throws Exception{
  437. DBConnect dbc=new DBConnect();
  438. ResultSet rs=dbc.executeQuery("select topic,body,rootID,dateandtime,username from bbs.bbs1 where locktopic!=2 and boardID="+forumID+" order by announceid desc");
  439. String lastTopic,body,lastPost,lastPostUser;
  440. int lastRootID;
  441. if (rs.next()) {
  442. lastTopic=rs.getString(1);
  443. body=rs.getString(2);
  444. if(lastTopic==null||"".equals(lastTopic)){
  445. if(body.length()>14)
  446. lastTopic=body.substring(0,14);
  447. else lastTopic=body;
  448. }
  449. lastRootID=rs.getInt(3);
  450. lastPost=rs.getString(4);
  451. lastPostUser=rs.getString(5);
  452. }
  453. else{
  454. lastTopic="无";
  455. lastRootID=0;
  456. lastPost=Format.getDateTime();
  457. lastPostUser="无";
  458. }
  459. rs.close();
  460. sql="update bbs.board set lastTopic=?,lastRootID='"+lastRootID+"',lastPosttime='"+lastPost+"',lastPostuser=? where boardID="+forumID;
  461. dbc.prepareStatement(sql);
  462. dbc.setBytes(1,(new String(lastTopic.getBytes("ISO-8859-1"),"GBK")).getBytes());
  463. dbc.setBytes(2,(new String(lastPostUser.getBytes("ISO-8859-1"),"GBK")).getBytes());
  464. dbc.executeUpdate();
  465. dbc.close();
  466. }
  467. public void  forumNumAdd(int forumID,int topicNum,int postNum,int todayNum,DBConnect dbc) throws Exception {
  468. sql="update bbs.board set lastbbsnum=lastbbsnum+"+postNum+",lastTopicNum=lastTopicNum+"+topicNum+",todayNum=todayNum+"+todayNum+" where boardID="+forumID;
  469. dbc.executeUpdate(sql);
  470. }
  471. //'版面发帖数减少
  472. public  void forumNumSub(int forumID,int topicNum,int postNum,int todayNum,DBConnect dbc) throws Exception {
  473. sql="update bbs.board set lastbbsnum=lastbbsnum-"+postNum+",lastTopicNum=lastTopicNum-"+topicNum+",todayNum=todayNum-"+todayNum+" where boardID="+forumID;
  474. //'response.write sql
  475. //'response.end
  476. dbc.executeUpdate(sql);
  477. }
  478. //'所有论坛发帖数增加
  479. public void  allForumNumAdd(int todayNum,int postNum,int topicNum,DBConnect dbc) throws Exception {
  480. sql="update bbs.config set TodayNum=todayNum+"+todayNum+",BbsNum=bbsNum+"+postNum+",TopicNum=topicNum+"+topicNum;
  481. dbc.executeUpdate(sql);
  482. }
  483. //'所有论坛发帖数减少
  484. public void allForumNumSub(int todayNum,int postNum,int topicNum,DBConnect dbc) throws Exception{
  485. sql="update bbs.config set TodayNum=todayNum-"+todayNum+",BbsNum=bbsNum-"+postNum+",TopicNum=topicNum-"+topicNum;
  486. dbc.executeUpdate(sql);
  487. }
  488. }