Board.Asp
上传用户:btntkt
上传日期:2021-04-16
资源大小:5296k
文件大小:34k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

DOS

  1. <!--#include file="check.asp"-->
  2. <%
  3. const maxdepth=3
  4. server.scripttimeout =999999
  5. response.write("<body>")
  6. call showtable("论坛版面管理","<center><a href='?'>论坛管理</a> | <a href=""?action=addclass"">增加分类</a> | <a href=""?action=addboard"">增加论坛</a> | <a href=""?action=classorders"">分类排序</a> | <a href=""?action=boardunite"">论坛合并</a></center>")
  7. response.flush
  8. select case request("action")
  9. case "addclass"
  10. addclass
  11. case "saveclass"
  12. saveclass
  13. case "editclass"
  14. editclass
  15. case "saveeditclass"
  16. saveeditclass
  17. case "delclass"
  18. delclass
  19. case "addboard"
  20. addboard
  21. case "saveboard"
  22. saveboard
  23. case "editboard"
  24. editboard
  25. case "saveeditboard"
  26. saveeditboard
  27. case "delboard"
  28. delboard
  29. case "classorders"
  30. classorders
  31. case "saveclassorders"
  32. saveclassorders
  33. case "boardunite"
  34. boardunite
  35. case "saveboardunite"
  36. saveboardunite
  37. case "passuser"
  38. passuser
  39. case "savepassuser"
  40. savepassuser
  41. case "ordersboard"
  42. ordersboard
  43. case else
  44. boardinfo()
  45. end select
  46. adminfooter()
  47. sub boardinfo
  48. dim rs,brs,i,install,temp,ii,po,boardtype
  49. %>
  50. <div class="ta">
  51. <div class="th1 jz w390">论坛版面</div>
  52. <div class="th1 jz w390">相应操作</div>
  53. <%
  54. set rs=yxbbs.execute("select boardid,boardname,parentid,depth,child,boardtype from [yx_board] order by rootid,orders")
  55. if rs.eof or rs.bof then
  56. call goback("","论坛没有分类!请先<a href=board.asp?action=addclass> 添加分类</a>")
  57. exit sub
  58. end if
  59. brs=rs.getrows(-1)
  60. rs.close
  61. for i=0 to ubound(brs,2)
  62. temp=""
  63. install="&nbsp;&nbsp;<a href='?action=addboard&boardid="&brs(0,i)&"'>添加论坛</a>"
  64. if brs(3,i)=0 then'分类
  65. temp="<div class=""td1 jz"" style=""text-align: left;"">"&temp
  66. if brs(4,i)>0 then'如果有子论坛
  67. temp=temp&brs(1,i)&" ("&brs(4,i)&")"
  68. else
  69. temp=temp&brs(1,i)
  70. end if
  71. install=install & "&nbsp;|&nbsp;<a href='?action=editclass&boardid="&brs(0,i)&"'>分类改名</a>"
  72. if brs(4,i)>0 then
  73. install=install & "&nbsp;|&nbsp;<a href=javascript:alert('不能删除!该分类含有论坛!nn要删除本类,必须先把属下的论坛删除或移走。')>删除分类</a>"
  74. else
  75. install=install & "&nbsp;|&nbsp;<a onclick=checkclick('删除后将不能恢复!您确定要删除吗?') href='?action=delclass&boardid="&brs(0,i)&"'>删除分类</a>"
  76. end if
  77. else'版面
  78. temp="<div class=""td1 jz"" style=""text-align: left;"">"&temp
  79. po=""
  80. for ii=1 to brs(3,i)
  81. po=po&" <font color=red>∣</font> "
  82. next
  83. if brs(4,i)>0 then'如果有子论坛
  84. temp=temp&po&brs(1,i)&" ("&brs(4,i)&")"
  85. else
  86. temp=temp&po&brs(1,i)
  87. end if
  88. install=install & " | <a href='?action=editboard&boardid="&brs(0,i)&"'>修改</a>"
  89. if brs(4,i)>0 then
  90. install=install & " | <a href='javascript:' onclick=alert('不能删除!该版面含有子论坛!nn要删除本版,必须先把属下的子论坛删除或移走。')>删除</a>"
  91. else
  92. install=install & " | <a onclick=checkclick('删除后将不能恢复!您确定要删除吗?') href='?action=delboard&boardid="&brs(0,i)&"'>删除</a>"
  93. end if
  94. install=install & " | <a href='?action=ordersboard&boardid="&brs(0,i)&"'>置前</a>"
  95. if brs(5,i) then
  96. install=install & " | <a href='?action=passuser&boardid="&brs(0,i)&"'>认证用户</a>"
  97. end if
  98. end if
  99. response.write(temp&"</div><div class=""td2 jz"" style=""text-align: left;"">"&install&"</div>")
  100. next
  101. %>
  102. <div style='clear: both;'></div> 
  103. </div>
  104. <%
  105. end sub
  106. sub addclass
  107. dim newboardid
  108. set rs=yxbbs.execute("select max(boardid) from [yx_board]")
  109. if rs.eof or rs.bof then
  110. newboardid=1
  111. else
  112. newboardid=rs(0)+1
  113. end if
  114. if not isnumeric(newboardid) then newboardid=1
  115. rs.close
  116. %><form method=post style="margin:0" action="?action=saveclass">
  117.         <div class="ta">
  118.         <div class="th jz">添加分类</div>
  119.         <div class="td1 h30"><b>分类名称:</b><br />论坛的分类名称</div>
  120.         <div class="td2 h30" style="text-align: left;"><input name="newboardid" type="hidden" value="<%=newboardid%>"><input type=text name="boardname" size=30></div>
  121.         <div style="clear: both;"></div><div class="tf jz"><input type="submit" value=" 提 交 ">&nbsp;&nbsp;<input type="reset" value=" 重 置 "></div></form> </div>
  122. <%
  123. end sub
  124. sub saveclass
  125. dim boardname,newboardid,maxrootid
  126. boardname=yxbbs.fun.getstr("boardname")
  127. newboardid=yxbbs.fun.getstr("newboardid")
  128. if boardname="" or not isnumeric(newboardid) then
  129. call goback("",""):exit sub
  130. else
  131. set rs=yxbbs.execute("select boardid from [yx_board] where boardid="&newboardid)
  132. if not (rs.eof and rs.bof) then
  133. call goback("错误提示","不能指定和别的论坛一样的序号!")
  134. exit sub
  135. end if
  136. rs.close
  137. set rs=yxbbs.execute("select max(rootid) from yx_board")
  138. maxrootid=rs(0)+1
  139. if isnull(maxrootid) then maxrootid=1
  140. rs.close
  141. yxbbs.execute("insert into [yx_board](boardname,boardid,boardsetting,rootid,depth,parentid,orders,child,parentstr)values('"&boardname&"',"&newboardid&",'0,0,30,30720,10,0,0,0,0,0,0',"&maxrootid&",0,0,0,0,'0')")
  142. call suc("","成功的添加了论坛分类 <b>"&boardname&"</b> !","?")
  143. end if
  144. end sub
  145. sub editclass
  146. dim boardid
  147. set rs=yxbbs.execute("select boardname from[yx_board] where boardid="&yxbbs.boardid&"")
  148. if rs.eof then
  149. call goback("系统出错","论坛找不到这个分类,可能已经删除了。"):exit sub
  150. end if
  151. %><form method=post style="margin:0" action="?action=saveeditclass">
  152.           <div class="ta">
  153.         <div class="th jz">添加分类</div>
  154.         <div class="td1 h30"><b>分类名称:</b><br />论坛的分类名称</div>
  155.         <div class="td2 h30" style="text-align: left;"><input name="boardid" type="hidden" value="<%=yxbbs.boardid%>"><input type=text name="boardname" value="<%=rs(0)%>" size=30></div>
  156.         <div style="clear: both;"></div><div class="tf"><input type="submit" value=" 提 交 ">&nbsp;&nbsp;<input type="reset" value=" 重 置 "></div></form></div>
  157. <%rs.close
  158. end sub
  159. sub saveeditclass
  160. dim boardname,boardid
  161. boardname=yxbbs.fun.getstr("boardname")
  162. boardid=yxbbs.fun.getstr("boardid")
  163. if boardname="" or not isnumeric(boardid) then
  164. call goback("",""):exit sub
  165. else
  166. if yxbbs.execute("select boardid from [yx_board] where boardid="&boardid).eof then
  167. call goback("系统出错","论坛找不到这个分类,可能已经删除了。"):exit sub
  168. end if
  169. yxbbs.execute("update [yx_board] set boardname='"&boardname&"' where boardid="&boardid)
  170. call suc("","成功的把论坛分类名称改为 <b>"&boardname&"</b> !","?")
  171. end if
  172. end sub
  173. sub delclass
  174. if  yxbbs.execute("select count(boardid) from[yx_board] where parentid="&yxbbs.boardid)(0)=0 then
  175. yxbbs.execute("delete from[yx_board] where parentid=0 and boardid="&yxbbs.boardid)
  176. call suc("","成功的删除了分类!","?")
  177. end if
  178. end sub
  179. sub addboard
  180. if yxbbs.execute("select boardid from [yx_board] where depth=0").eof then
  181. call goback("","没有分类不能添加论坛!请先<a href=board.asp?action=addclass> ·添加分类</a>")
  182. exit sub
  183. end if%>
  184.         <form method=post style="margin:0" action="?action=saveboard">
  185.         <div class="ta">
  186.         <div class="th jz">论坛添加</div>
  187.         <div class="td1 h40">论坛名称:</div>
  188.         <div class="td2 h40"><input type=text name="boardname" size=30></div>
  189.         <div class="td1 h40">标志图片:<br />论坛版面logo地址,可以不填</div>
  190.         <div class="td2 h40"><input type=text name="boardimg" size=30></div>
  191.         <div class="td1 h40">论坛版主:<br />添加多版主请用@@分隔,如:name@@name</div>
  192.         <div class="td2 h40"><input type=text name="boardadmin" size=30></div>
  193.         <div class="td1 h70">论坛介绍:</div>
  194.         <div class="td2 h70 w446"><textarea rows="3" name="introduce"></textarea></div>
  195. <div class="td1 h40">属于分类或论坛:</div>
  196.         <div class="td2 h40"><select size="1" name="parentid"><%=yxbbs.boardidlist(yxbbs.boardid,20)%></select></div>
  197. <div class="td1 h40">限制用户等级:</div>
  198.         <div class="td2 h40"><select size="1" name="boardgrade">
  199. <option value="0" selected>0级:游客</option>
  200. <%
  201. dim ug
  202. set ug=conn.execute("select gradenum,gradename from yx_usergrade order by gradenum asc")
  203. while not ug.eof
  204. response.write "<option value="&ug(0)&">"&ug(0)&"级:"&ug(1)&"</option>"
  205. ug.movenext
  206. wend
  207. set ug=nothing
  208. %>
  209. </select></div>
  210.         <div class="td1 h40">是否认证版面:<br />认证版只有版主和人证会员</div>
  211.         <div class="td2 h40"><input type="radio" value="1" name="boardtype">是&nbsp; <input name="boardtype" type="radio" value="0" checked="true">否</div>
  212.         <div class="td1 h40">锁定版面:<br /> 锁定之后不可以发布帖子</div>
  213.         <div class="td2 h40"><input type="radio" value="1" name="boardlock">是&nbsp; <input name="boardlock" type="radio" value="0" checked="true">否</div>
  214. <div style="clear: both;"></div><div class="tf jz"><input type="submit" value=" 提 交 ">&nbsp;&nbsp;<input type="reset" value=" 重 置 "></div>
  215.  </div></form>
  216. <%
  217. end sub
  218. sub saveboard
  219. dim boardname,introduce,boardadmin,boardimg,boardgrade,boardlock,boardtype,parentid,newboardid,rootid,depth,child,orders,parentstr,i
  220. boardname=yxbbs.fun.getstr("boardname")
  221. introduce=yxbbs.fun.getstr("introduce")
  222. boardadmin=yxbbs.fun.getstr("boardadmin")
  223. boardgrade=yxbbs.fun.getstr("boardgrade")
  224. boardlock=yxbbs.fun.getstr("boardlock")
  225. boardtype=yxbbs.fun.getstr("boardtype")
  226. boardimg=yxbbs.fun.getstr("boardimg")
  227. parentid=yxbbs.fun.getstr("parentid")
  228. if not isnumeric(parentid) or boardname="" or introduce="" then
  229. call goback("",""):exit sub
  230. end if
  231. set rs=yxbbs.execute("select max(boardid) from [yx_board]")
  232. if rs.eof or rs.bof then
  233. call goback("","没有分类不能添加论坛!请先<a href=board.asp?action=addclass> ·添加分类</a>")
  234. exit sub
  235. else
  236. newboardid=rs(0)+1
  237. end if
  238. rs.close
  239. set rs=yxbbs.execute("select rootid,depth,child,orders,parentstr,parentid from[yx_board] where boardid="&parentid&"")
  240. if rs.eof or rs.bof then
  241. call goback("系统程序出错!","没有指定父类或父论坛!")
  242. exit sub
  243. end if
  244. rootid=rs(0)
  245. depth=rs(1)
  246. child=rs(2)
  247. orders=rs(3)
  248. parentstr=rs(4)
  249. rs.close
  250. if depth+1>maxdepth then
  251. call goback("","考虑到论坛的实用易用,本论坛限制了最多只能有" & maxdepth & "级论坛!")
  252. exit sub
  253. end if
  254. if parentstr=0 then
  255. parentstr=parentid
  256. else
  257. parentstr=parentstr & "," & parentid
  258. end if
  259. yxbbs.execute("insert into [yx_board](boardid,boardname,introduce,boardadmin,boardimg,boardsetting,boardlock,boardtype,rootid,depth,parentid,parentstr,orders,child)values("&newboardid&",'"&boardname&"','"&introduce&"','"&boardadmin&"','"&boardimg&"','0,gif|jpg|swf|zip|rar|bmp,30,30720,10,0,0,0,0,0,0,4',"&boardlock&","&boardtype&","&rootid&","&depth+1&","&parentid&",'"&parentstr&"',"&orders+1&",0)")
  260. if boardadmin <> "" then call addmaster(boardadmin,"none",0)
  261. if parentid<>0 then
  262. if depth>0 then
  263. '当上级分类深度大于0的时候要更新其父类(或父类的父类)的版面数和相关排序
  264. for i=1 to depth
  265. '更新其父类版面数
  266. yxbbs.execute("update [yx_board] set child=child+1 where boardid="&parentid)
  267. '得到其父类的父类的版面id
  268. set rs=yxbbs.execute("select parentid from [yx_board] where boardid="&parentid)
  269. if not (rs.eof and rs.bof) then
  270. parentid=rs(0)
  271. end if
  272. rs.close
  273. '当循环次数大于1并且运行到最后一次循环的时候直接进行更新
  274. if i=depth then
  275. yxbbs.execute("update [yx_board] set child=child+1 where boardid="&parentid)
  276. end if
  277. next
  278. '更新该版面排序以及大于本需要和同在本分类下的版面排序序号
  279. yxbbs.execute("update [yx_board] set orders=orders+1 where rootid="&rootid&" and orders>"&orders)
  280. yxbbs.execute("update [yx_board] set orders="&orders&"+1 where boardid="&newboardid&"")
  281. else
  282. '当上级分类深度为0的时候只要更新上级分类版面数
  283. yxbbs.execute("update [yx_board] set child=child+1 where boardid="&parentid)
  284. set rs=yxbbs.execute("select max(orders) from [yx_board]")
  285. yxbbs.execute("update [yx_board] set orders="&rs(0)&"+1 where boardid="&newboardid )
  286. rs.close
  287. end if
  288. end if
  289. call suc("","成功的添加了论坛 <b>"&boardname&"</b> !","board.asp")
  290. end sub
  291. sub editboard
  292. dim boardname,boardlock,boardtype,introduce,boardimg,parentid,boardadmin,boardgrade
  293. set rs=yxbbs.execute("select parentid,boardname,boardadmin,boardgrade,boardlock,boardtype,introduce,boardimg from[yx_board] where boardid="&yxbbs.boardid&"")
  294. if rs.eof then
  295. call goback("","该版面不存在,可能已经删除了")
  296. exit sub
  297. else
  298. parentid=rs(0)
  299. boardname=rs(1)
  300. boardadmin=rs(2)
  301. boardgrade=rs(3)
  302. boardlock=rs(4)
  303. boardtype=rs(5)
  304. introduce=rs(6)
  305. boardimg=rs(7)
  306. end if
  307. rs.close%><form method=post style="margin:0" action="?action=saveeditboard">
  308.          <div class="ta">
  309.         <div class="th jz">论坛修改</div>
  310.         <div class="td1 h40">论坛名称:</div>
  311.         <div class="td2 h40"><input name="boardid" value="<%=yxbbs.boardid%>" type="hidden"><input name="boardname" type=text value="<%=boardname%>" size=30></div>
  312.         <div class="td1 h40">标志图片:<br />论坛版面logo地址,可以不填</div>
  313.         <div class="td2 h40"><input type=text name="boardimg" value="<%=boardimg%>" size=30></div>
  314.         <div class="td1 h40">论坛版主:<br />添加多版主请用@@分隔,如:name@@name</div>
  315.         <div class="td2 h40"><input type=text name="boardadmin" size=30 value="<%=boardadmin%>"><input type="hidden" name="oldboardadmin" size=30 value="<%=boardadmin%>"></div>
  316.         <div class="td1 h70">论坛介绍:</div>
  317.         <div class="td2 h70 w446"><textarea rows="3" name="introduce"><%=introduce%></textarea></div>
  318. <div class="td1 h40">属于分类或论坛:</div>
  319.         <div class="td2 h40"><select size="1" name="parentid"><%=yxbbs.boardidlist(parentid,20)%></select></div>
  320. <div class="td1 h40">限制用户等级:</div>
  321.         <div class="td2 h40"><select size="1" name="boardgrade">
  322. <option value="0" selected>0级:游客</option>
  323. <%
  324. dim ug
  325. set ug=conn.execute("select gradenum,gradename from yx_usergrade order by gradenum asc")
  326. while not ug.eof
  327. if ug(0)=boardgrade then
  328. response.write "<option value="&ug(0)&" selected>"&ug(0)&"级:"&ug(1)&"</option>"
  329. else
  330. response.write "<option value="&ug(0)&">"&ug(0)&"级:"&ug(1)&"</option>"
  331. end if
  332. ug.movenext
  333. wend
  334. set ug=nothing
  335. %></select></div>
  336.         
  337.         <div class="td1 h40">是否认证版面:<br />认证版只有版主和人证会员</div>
  338.         <div class="td2 h40"><input type="radio" value="1" name="boardtype" <%if boardtype=1 then response.write "checked=""true"""%>>是&nbsp; <input type="radio" value="0" name="boardtype" <%if boardtype=0 then response.write "checked=""true"""%>>否</div>
  339. <div class="td1 h40">锁定版面:<br /> 锁定之后不可以发布帖子</div>
  340.         <div class="td2 h40"><input type="radio" value="1" name="boardlock" <%if boardlock=1 then response.write "checked=""true""" %>>是&nbsp; <input type="radio" value="0" name="boardlock" <%if boardlock=0 then response.write "checked=""true"""%>>否</div>
  341. <div style="clear: both;"></div><div class="tf jz"><input type="submit" value=" 提 交 ">&nbsp;&nbsp;<input type="reset" value=" 重 置 "></div>
  342. </div></form>
  343. <%
  344. end sub
  345. sub saveeditboard
  346. dim boardid,boardname,introduce,boardadmin,oldboardadmin,boardgrade,boardlock,boardtype,boardimg,parentid,rootid,depth,child,orders,parentstr,i
  347. dim newparentid,boardnum,p_rs
  348. boardid=yxbbs.fun.getstr("boardid")
  349. boardname=yxbbs.fun.getstr("boardname")
  350. introduce=yxbbs.fun.getstr("introduce")
  351. boardadmin=yxbbs.fun.getstr("boardadmin")
  352. boardgrade=yxbbs.fun.getstr("boardgrade")
  353. oldboardadmin=yxbbs.fun.getstr("oldboardadmin")
  354. boardlock=yxbbs.fun.getstr("boardlock")
  355. boardtype=yxbbs.fun.getstr("boardtype")
  356. boardimg=yxbbs.fun.getstr("boardimg")
  357. newparentid=yxbbs.fun.getstr("parentid")
  358. if not isnumeric(newparentid) or boardname="" or introduce="" then
  359. call goback("",""):exit sub
  360. elseif boardid=newparentid then
  361. call goback("","所属论坛不能指定自己!"):exit sub
  362. end if
  363. set rs=yxbbs.execute("select rootid,depth,child,orders,parentid,parentstr from[yx_board] where boardid="&boardid)
  364. if rs.eof or rs.bof then
  365. call goback("系统出错!","该版面不存在,可能已经删除了!")
  366. exit sub
  367. end if
  368. rootid=rs(0)
  369. depth=rs(1)
  370. child=rs(2)
  371. orders=rs(3)
  372. parentid=rs(4)
  373. parentstr=rs(5)
  374. rs.close
  375. if parentid=0 then
  376. call goback("系统出错!","分类不能设置"):exit sub
  377. elseif int(newparentid)<>int(parentid) then
  378. '判断所指定的论坛是否其下属论坛
  379. set rs=yxbbs.execute("select boardid from [yx_board] where parentstr like '%"&parentstr&","&boardid&"%' and boardid="&newparentid)
  380. if not (rs.eof and rs.bof) then
  381. call goback("","您不能指定该版面的下属子论坛作为所属论坛")
  382. exit sub
  383. end if
  384. rs.close
  385. '获得新选的父级
  386. set p_rs=yxbbs.execute("select * from [yx_board] where boardid="&newparentid)
  387. if p_rs("depth")+1> maxdepth or (child>0 and p_rs("depth")+2>maxdepth) then
  388. p_rs.close:set p_rs=nothing
  389. call goback("","本论坛限制了最多只能有" & maxdepth & "级论坛.")
  390. exit sub
  391. end if
  392. end if
  393. yxbbs.execute("update [yx_board] set boardname='"&boardname&"',introduce='"&introduce&"',boardadmin='"&boardadmin&"',boardgrade="&boardgrade&",boardlock="&boardlock&",boardtype="&boardtype&",boardimg='"&boardimg&"' where boardid="&boardid&"")
  394. if boardadmin <> oldboardadmin then call addmaster(boardadmin,oldboardadmin,1)
  395. if int(newparentid)<>int(parentid) then
  396. '将一个分论坛移动到其他分论坛下
  397. '获得所指定的论坛的相关信息
  398. '得到其下属版面数
  399. parentstr=parentstr & ","
  400. boardnum=yxbbs.execute("select count(*) from [yx_board] where parentstr like '%"&parentstr & boardid&"%'")(0)
  401. if isnull(boardnum) then boardnum=1
  402. '在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
  403. yxbbs.execute("update [yx_board] set orders=orders + "&boardnum&"+1  where rootid="&p_rs("rootid")&" and orders>"&p_rs("orders")&"")
  404. '更新当前版面数据
  405. if p_rs("parentstr")="0" then
  406. yxbbs.execute("update [yx_board] set depth="&p_rs("depth")&"+1,orders="&p_rs("orders")&"+1,rootid="&p_rs("rootid")&",parentid="&newparentid&",parentstr='" & p_rs("boardid") & "' where boardid="&boardid)
  407. else
  408. yxbbs.execute("update [yx_board] set depth="&p_rs("depth")&"+1,orders="&p_rs("orders")&"+1,rootid="&p_rs("rootid")&",parentid="&newparentid&",parentstr='" & p_rs("parentstr") & ","& p_rs("boardid") &"' where boardid="&boardid)
  409. end if
  410. dim tempparentstr
  411. i=1
  412. '更新下属,同时获得移动总数i
  413. '如果有则更新下属版面数据
  414. '深度为原有深度加上当前所属论坛的深度
  415. set rs=yxbbs.execute("select * from [yx_board] where parentstr like '%"&parentstr & boardid&"%' order by orders")
  416. do while not rs.eof
  417. i=i+1
  418. if p_rs("parentstr")="0" then'如果其父级为类,那么其下属的版面数据
  419. tempparentstr=p_rs("boardid") & "," & replace(rs("parentstr"),parentstr,"")
  420. else
  421. tempparentstr=p_rs("parentstr") & "," & p_rs("boardid") & "," & replace(rs("parentstr"),parentstr,"")
  422. end if
  423. yxbbs.execute("update [yx_board] set depth=depth+"&p_rs("depth")&"-"&depth&"+1,orders="&p_rs("orders")&"+"&i&",rootid="&p_rs("rootid")&",parentstr='"&tempparentstr&"' where boardid="&rs("boardid"))
  424. rs.movenext
  425. loop
  426. rs.close
  427. dim tempparentid,ii
  428. tempparentid=newparentid
  429. if rootid=p_rs("rootid") then'在同一分类下移动
  430. '更新所指向的上级论坛版面数,i为本次移动过来的版面数
  431. '更新其父类版面数
  432. yxbbs.execute("update [yx_board] set child=child+"&i&" where (not parentid=0) and boardid="&tempparentid)
  433. for ii=1 to p_rs("depth")
  434. '得到其父类的父类的版面id
  435. set rs=yxbbs.execute("select parentid from [yx_board] where (not parentid=0) and boardid="&tempparentid)
  436. if not (rs.eof and rs.bof) then
  437. tempparentid=rs(0)
  438. '更新其父类的父类版面数
  439. yxbbs.execute("update [yx_board] set child=child+"&i&" where (not parentid=0) and boardid="&tempparentid)
  440. ''''yxbbs.execute("update [yx_board] set child=child+"&i&" where (not parentid=0) and boardid in ())
  441. end if
  442. next
  443. '更新其原父类版面数
  444. yxbbs.execute("update [yx_board] set child=child-"&i&" where (not parentid=0) and boardid="&parentid)
  445. '更新其原来所属论坛数据
  446. for ii=1 to depth
  447. '得到其原父类的父类的版面id
  448. set rs=yxbbs.execute("select parentid from [yx_board] where (not parentid=0) and boardid="&parentid)
  449. if not (rs.eof and rs.bof) then
  450. parentid=rs(0)
  451. '更新其原父类的父类版面数
  452. yxbbs.execute("update [yx_board] set child=child-"&i&" where (not parentid=0) and  boardid="&parentid)
  453. end if
  454. next
  455. else
  456. '更新所指向的上级论坛版面数,i为本次移动过来的版面数
  457. '更新其父类版面数
  458. yxbbs.execute("update [yx_board] set child=child+"&i&" where boardid="&tempparentid)
  459. for ii=1 to p_rs("depth")
  460. '得到其父类的父类的版面id
  461. set rs=yxbbs.execute("select parentid from [yx_board] where boardid="&tempparentid)
  462. if not (rs.eof and rs.bof) then
  463. tempparentid=rs(0)
  464. '更新其父类的父类版面数
  465. yxbbs.execute("update [yx_board] set child=child+"&i&" where  boardid="&tempparentid)
  466. end if
  467. next
  468. '更新其原父类版面数
  469. yxbbs.execute("update [yx_board] set child=child-"&i&" where boardid="&parentid)
  470. '更新其原父类的其它版面排序
  471. yxbbs.execute("update [yx_board] set orders=orders-"&i&" where rootid="&rootid&" and orders>"&orders)
  472. '更新其原来所属论坛数据
  473. for ii=1 to depth
  474. '得到其原父类的父类的版面id
  475. set rs=yxbbs.execute("select parentid from [yx_board] where boardid="&parentid)
  476. if not (rs.eof and rs.bof) then
  477. parentid=rs(0)
  478. '更新其原父类的父类版面数
  479. yxbbs.execute("update [yx_board] set child=child-"&i&" where boardid="&parentid)
  480. end if
  481. next
  482. end if
  483. p_rs.close:set p_rs=nothing
  484.   end if
  485. call suc("","论坛修改成功 !","board.asp")
  486. end sub
  487. sub delboard
  488. dim alltable,i,ii,depth,parentid,rootid,orders
  489. set rs=yxbbs.execute("select depth,parentid,rootid,orders,child from[yx_board] where boardid="&yxbbs.boardid)
  490. if rs.eof then 
  491. call goback("系统出错","不存在,论坛可能已经删除了 !")
  492. exit sub
  493. elseif rs(4)>0 then
  494. call goback("系统出错","该论坛含有属下论坛,不能删除 !")
  495. exit sub
  496. else
  497. depth=rs(0)
  498. parentid=rs(1)
  499. rootid=rs(2)
  500. orders=rs(3)
  501. end if
  502. rs.close
  503. alltable=split(yxbbs.bbstable(0),",")
  504. for i=0 to ubound(alltable)
  505. yxbbs.execute("delete from [yx_bbs"&alltable(i)&"] where boardid="&yxbbs.boardid&"")
  506. next
  507. set rs=yxbbs.execute("select topicid from[yx_topic] where boardid="&yxbbs.boardid&" and isvote ")
  508. do while not rs.eof
  509. yxbbs.execute("delete from [yx_topicvote] where topicid="&rs(0))
  510. yxbbs.execute("delete from [yx_topicvoteuser] where topicid="&rs(0))
  511. rs.movenext
  512. loop
  513. rs.close
  514. '删除主题记录
  515. yxbbs.execute("delete from[yx_topic] where boardid="&yxbbs.boardid)
  516. yxbbs.execute("delete from[yx_board] where boardid="&yxbbs.boardid)
  517. '更新其父类的版面数
  518. yxbbs.execute("update [yx_board] set child=child-1 where boardid="&parentid)
  519. '更新其父类的其它版面排序
  520. yxbbs.execute("update [yx_board] set orders=orders-1 where rootid="&rootid&" and orders>"&orders)
  521. '更新其所属论坛数据
  522. for ii=1 to depth
  523. '得到其父类的父类的版面id
  524. set rs=yxbbs.execute("select parentid from [yx_board] where boardid="&parentid)
  525. if not (rs.eof and rs.bof) then
  526. parentid=rs(0)
  527. '更新其父类的父类版面数
  528. yxbbs.execute("update [yx_board] set child=child-1 where boardid="&parentid)
  529. end if
  530. rs.close
  531. next
  532. call suc("","成功的删除论坛版面 (包括该论坛的所有帖子)!","board.asp")
  533. end sub
  534. sub classorders
  535. dim boardid
  536. set rs=yxbbs.execute("select boardid,boardname,rootid from[yx_board] where depth=0 order by rootid")
  537. if rs.eof then
  538. call goback("","论坛没有分类!请先<a href=?action=addclass> 添加分类</a>")
  539. exit sub
  540. end if
  541. %><form method=post style="margin:0" action="?action=saveclassorders">
  542.         <div class="ta">
  543. <div class="th jz">分类排序</div>
  544.        
  545.         <%
  546. do while not rs.eof
  547. response.write"<div class=""td1 h30"">&nbsp;"&rs(1)&"</div><div class=""td2 h30""><input name='boardid' type='hidden' value='"&rs(0)&"'><input name='rootid' type='hidden' value='"&rs(2)&"'><input type=text name='newrootid' value='"&rs(2)&"' size=4 ></div>"
  548. rs.movenext
  549. loop
  550. %><div style="clear: both;"></div><div class="tf jz"><input type="submit" value=" 修 改 ">&nbsp;&nbsp;<input type="reset" value=" 重 置 "></div>
  551.         </div></form>
  552. <%rs.close
  553. end sub
  554. sub saveclassorders
  555. dim boardid,rootid,newrootid,temp,i
  556. temp=","
  557. for i=1 to request.form("boardid").count
  558. boardid = request.form("boardid")(i)
  559. rootid = request.form("rootid")(i)
  560. newrootid = request.form("newrootid")(i)
  561. if instr(temp,","&newrootid&",")>0 then 
  562. call goback("排序错误","各分类排序的数字不能一样!")
  563. exit sub
  564. end if
  565. temp=temp&newrootid&","
  566. if not isnumeric(boardid) or not isnumeric(newrootid) then
  567. call goback("排序错误","请用数字填写!")
  568. exit sub
  569. end if
  570. next
  571. for i=1 to request.form("boardid").count
  572. boardid = request.form("boardid")(i)
  573. rootid = request.form("rootid")(i)
  574. newrootid = request.form("newrootid")(i)
  575. if rootid<>newrootid then
  576. yxbbs.execute("update [yx_board]set rootid="&newrootid&" where boardid="&boardid)
  577. temp=boardid
  578. yxbbs.execute("update [yx_board] set rootid="&newrootid&" where parentstr like '%"&temp&"%' and rootid="&rootid&"")
  579. end if
  580. next
  581. call suc("","排序成功!","?")
  582. end sub
  583. sub addmaster(s,o,n)
  584. dim arr,oarr,i,sql
  585. dim gradenum,gradename,gradepic
  586. set rs=conn.execute("select gradenum,gradename,gradepic from yx_usergrade where classid = 3 order by userminpostnum desc")
  587. if not (rs.eof and rs.bof) then
  588. gradenum = rs(0)
  589. gradename = rs(1)
  590. gradepic = rs(2)
  591. end if
  592. randomize
  593. arr = split(s,"@@")
  594. oarr = split(o,"@@")
  595. set rs = server.createobject("adodb.recordset")
  596. for i = 0 to ubound(arr)
  597. sql = "select * from [yx_user] where name = '" & arr(i) & "'"
  598. rs.open sql,conn,1,3
  599. if rs.eof and rs.bof then
  600. call goback("",arr(i) &"这个用户还没有注册!")
  601. else
  602. if rs("classid") = 5 then
  603. rs("gradenum") = gradenum
  604. rs("classid") = 3
  605. rs.update
  606. end if
  607. end if
  608. rs.close
  609. next
  610. '判断原版主在其他版面是否还担任版主,如没有担任则撤换该用户职位。
  611. if n = 1 then
  612. dim iboardmaster
  613. dim usergrade, article
  614. iboardmaster = false
  615. for i = 0 to ubound(oarr)
  616. set rs = yxbbs.execute("select boardadmin from yx_board")
  617. do while not rs.eof
  618. if instr("|" & trim(rs(0)) & "|","|" & trim(oarr(i)) & "|") > 0 then
  619. iboardmaster = true
  620. exit do
  621. end if
  622. rs.movenext
  623. loop
  624. if not iboardmaster then
  625. set rs = yxbbs.execute("select id,classid,essaynum from [yx_user] where name='" & trim(oarr(i)) & "' or classid=3")
  626. if not (rs.eof and rs.bof) then
  627. 'if rs(1) > 2 then
  628. if not isnumeric(rs(2)) or rs(2) = "" then
  629. article = 0
  630. else
  631. article = cstr(rs(2))
  632. end if
  633. '取对应注册会员的等级
  634. set usergrade = yxbbs.execute("select top 1 gradenum,gradename,gradepic from yx_usergrade where userminpostnum <= " & article & " and not userminpostnum = -1 and classid = 5 order by userminpostnum desc")
  635. if not (usergrade.eof and usergrade.bof) then
  636. yxbbs.execute("update [yx_user] set gradenum="&usergrade(0)&",classid=5 where id="&rs(0))
  637. end if
  638. usergrade.close:set usergrade = nothing
  639. 'end if
  640. end if
  641. end if
  642. iboardmaster = false
  643. next
  644. end if
  645. set rs = nothing
  646. end sub
  647. sub boardunite
  648. %><form method=post style="margin:0" action="?action=saveboardunite">
  649.         <div class="ta">
  650.         <div class="th jz">论坛合并</div>
  651.         <div class="td w772">将论坛: 
  652.   <select size="1" name="boardid"><option value='0'>请选择原论坛</option><%=yxbbs.boardidlist(0,0)%></select> 合并到论坛: <select size="1" name="newboardid"><option value='0'>请选择目标论坛</option><%=yxbbs.boardidlist(0,0)%></select> 中 <input type="submit" onclick=checkclick('操作后将不能恢复!您确定要合并吗?') value=" 论坛合并 ">
  653. <br /><br /><b>注意事项:</b><font color=red>此操作不可恢复,请慎重操作!</font><br />
  654. 分类不能操作,不能和其属下的论坛合并。<br />
  655. 合并后原论坛(包括属下论坛)将被删除,所有帖子(包括属下论坛的帖子)将转移到指定的目标论坛中</div>
  656. <div style="clear: both;"></div></div></form>
  657. <%
  658. end sub
  659. sub saveboardunite
  660. dim boardid,newboardid,tempparentstr,tempparentid,rs1
  661. dim i,alltable
  662. dim parentstr,depth,parentid,child,rootid
  663. boardid=yxbbs.fun.getstr("boardid")
  664. newboardid=yxbbs.fun.getstr("newboardid")
  665. if boardid="" or newboardid="" then
  666. call goback("","请先指定论坛后再进行合并!")
  667. exit sub
  668. elseif boardid=newboardid then
  669. call goback("","同一个论坛不用合并了!")
  670. exit sub
  671. end if
  672. set rs=yxbbs.execute("select parentstr,boardid,depth,parentid,child,rootid from yx_board where boardid="&boardid)
  673. if rs(2)="0" then
  674. call goback("系统错误","分类不能做合并操作!")
  675. exit sub
  676. end if
  677. parentstr=rs(0) & "," & rs(1)
  678. parentid=rs(3)
  679. tempparentstr=rs(1)
  680. depth=rs(2)
  681. child=rs(4)+1
  682. rootid=rs(5)
  683. rs.close
  684. tempparentid=parentid
  685. '判断是否合并到下属论坛
  686. set rs=yxbbs.execute("select boardid from [yx_board] where boardid="&newboardid&" and parentstr like '%"&parentstr&"%'")
  687. if not (rs.eof and rs.bof) then
  688. call goback("","不能将论坛合并到其下属论坛中!")
  689. exit sub
  690. end if
  691. rs.close
  692. '得到全部下属论坛id
  693. i=0
  694. set rs=yxbbs.execute("select boardid from [yx_board] where rootid="&rootid&" and parentstr like '%"&parentstr&"%'")
  695. do while not rs.eof
  696. if i=0 then
  697. tempparentstr=rs(0)
  698. else
  699. tempparentstr=tempparentstr & "," & rs(0)
  700. end if
  701. i=i+1
  702. rs.movenext
  703. loop
  704. if i>0 then
  705. parentstr=tempparentstr & "," & boardid
  706. else
  707. parentstr=boardid
  708. end if
  709. '更新其原来所属论坛版面数
  710. yxbbs.execute("update [yx_board] set child=child-"&child&" where boardid="&tempparentid)
  711. '更新其原来所属论坛数据,排序相当于剪枝而不需考虑
  712. for i=1 to depth
  713. '得到其父类的父类的版面id
  714. set rs=yxbbs.execute("select parentid from [yx_board] where boardid="&tempparentid)
  715. if not (rs.eof and rs.bof) then
  716. tempparentid=rs(0)
  717. yxbbs.execute("update [yx_board] set child=child-"&child&" where boardid="&tempparentid)
  718. end if
  719. next
  720. '更新论坛帖子数据
  721. alltable=split(yxbbs.bbstable(0),",")
  722. for i=0 to ubound(alltable)
  723. yxbbs.execute("update [yx_bbs"&alltable(i)&"] set boardid="&newboardid&" where boardid in ("&parentstr&")")
  724. next
  725. yxbbs.execute("update [yx_topic] set boardid="&newboardid&" where boardid in ("&parentstr&")")
  726. '删除被合并论坛
  727. set rs=yxbbs.execute("select sum(essaynum),sum(topicnum),sum(todaynum) from [yx_board] where rootid="&rootid&" and boardid in ("&parentstr&")")
  728. yxbbs.execute("delete from [yx_board] where rootid="&rootid&" and boardid in ("&parentstr&")")
  729. '更新新论坛帖子计数
  730. yxbbs.execute("update [yx_board] set essaynum=essaynum+"&rs(0)&",topicnum=topicnum+"&rs(1)&",todaynum=todaynum+"&rs(2)&" where boardid ="&newboardid&"")
  731. '更新上级版块
  732. set rs1=yxbbs.execute("select depth,parentstr,boardid from [yx_board] where boardid="&newboardid)
  733. if rs1(0)>1 then
  734. parentstr=rs1(0)
  735. yxbbs.execute("update [yx_board] set essaynum=essaynum+"&rs(0)&",topicnum=topicnum+"&rs(1)&",todaynum=todaynum+"&rs(2)&" where boardid in ("&parentstr&")")
  736. end if
  737. rs1.close:set rs1=nothing
  738. rs.close
  739. call suc("","合并成功!已经将原论坛(包括属下)的所有帖子合并到目标论坛。","?")
  740. end sub
  741. sub ordersboard
  742. dim boardid,parentid,rootid,orders,parentstr,i,boardnum,p_rs,boardname
  743. boardid=yxbbs.boardid
  744. set rs=yxbbs.execute("select orders,parentid,parentstr,boardname from[yx_board] where boardid="&yxbbs.boardid)
  745. if rs.eof or rs.bof then
  746. call goback("系统出错!","该版面不存在,可能已经删除了!")
  747. exit sub
  748. end if
  749. orders=rs(0)
  750. parentid=rs(1)
  751. parentstr=rs(2)
  752.         
  753. rs.close
  754. '当版面为类时
  755. if parentid=0 then call goback("系统出错!","版面id出错。"):exit sub
  756. '得到其下属版面数
  757. parentstr=parentstr & ","
  758. boardnum=yxbbs.execute("select count(*) from [yx_board] where parentstr like '%"&parentstr & boardid&"%'")(0)
  759. if isnull(boardnum) then boardnum=1
  760. '获得父级信息
  761. set p_rs=yxbbs.execute("select * from [yx_board] where boardid="&parentid)
  762. '在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
  763. yxbbs.execute("update [yx_board] set orders=orders + "&boardnum&"+1  where rootid="&p_rs("rootid")&" and orders>"&p_rs("orders")&"")
  764. '更新当前版面数据
  765. yxbbs.execute("update [yx_board] set orders="&p_rs("orders")&"+1 where boardid="&boardid)
  766. dim tempparentstr
  767. i=1
  768. '更新下属,同时获得移动总数i
  769. '如果有则更新下属版面数据
  770. set rs=yxbbs.execute("select * from [yx_board] where parentstr like '%"&parentstr & boardid&"%' order by orders")
  771. do while not rs.eof
  772. i=i+1
  773. if p_rs("parentstr")="0" then'如果其父级为类,那么其下属的版面数据
  774. tempparentstr=p_rs("boardid") & "," & replace(rs("parentstr"),parentstr,"")
  775. else
  776. tempparentstr=p_rs("parentstr") & "," & p_rs("boardid") & "," & replace(rs("parentstr"),parentstr,"")
  777. end if
  778. yxbbs.execute("update [yx_board] set orders="&p_rs("orders")&"+"&i&",parentstr='"&tempparentstr&"' where boardid="&rs("boardid"))
  779. rs.movenext
  780. loop
  781. rs.close
  782. p_rs.close
  783. set p_rs=nothing
  784. call suc("","成功的将该版面置前!","?")
  785. response.end
  786. end sub
  787. sub passuser
  788. set rs=yxbbs.execute("select passuser,boardname from [yx_board] where boardid="&yxbbs.boardid&" and parentid<>0")
  789. if rs.eof then
  790. call goback("","此论坛的类型不是认证论坛,不能设置认证用户。")
  791. exit sub
  792. end if%>
  793. <form method=post style='margin:0' action="?action=savepassuser">
  794. <div class="ta">
  795.         <div class="th jz">修改论坛认证用户</div>
  796.         <div class="td1">所在论坛:</div>
  797.         <div class="td2"><input name="boardid" value="<%=yxbbs.boardid%>" type="hidden"><%=rs("boardname")%></div>
  798.         <div class="td1 h50"><b>通过认证的用户:</b><br />各用户之间用“|”隔开<br />请不要使用回车键enter</div>
  799.         <div class="td2 h50 w446"><textarea name="passuser" rows="2"><%=rs("passuser")%></textarea></div>
  800. <div style="clear: both;"></div><div class="tf"><input type="submit" value=" 提 交 "> &nbsp;&nbsp;<input type="reset" name="submit" value=" 重 置 "></div></div></form>
  801. <%rs.close
  802. end sub
  803. sub savepassuser
  804. dim passusers,boardid
  805. boardid=yxbbs.fun.getstr("boardid")
  806. passusers=trim(replace(request.form("passuser"),"'",""))
  807. passusers=replace(passusers,chr(10), "")
  808. passusers=replace(passusers,chr(13), "")
  809. yxbbs.execute("update [yx_board] set passuser='"&passusers&"' where boardid="&boardid&" and parentid<>0")
  810. cache.name="boardinfo"
  811. cache.clean()
  812. call suc("","成功的更新了该论坛的认证会员!","?")
  813. end sub
  814. %>