⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_board.asp

📁 BBS源码 利用ASP的一个功能齐全的BBS论坛源码
💻 ASP
📖 第 1 页 / 共 3 页
字号:
	End if
	If BoardType=3 Then
		Call Suc("","成功的添加了论坛 <b>"&BoardName&"</b> !<li>此论坛为认证论坛,暂时只有最高管理员能够进入。<li>你可以通过 <a href=?Action=PassUser>管理</a> 项目来添加可以进入该论坛的用户","Admin_Board.asp")	
	Else
		Call Suc("","成功的添加了论坛 <b>"&BoardName&"</b> !","Admin_Board.asp")	
	End IF
	updateBoardCache
End Sub

Sub EditBoard
	Dim BoardName,BoardType,Introduce,BoardImg,ParentID
	Set Rs=BBS94KK.execute("Select ParentID,BoardName,BoardType,Introduce,BoardImg From[KK_Board] Where BoardID="&BBS94KK.BoardID&"")
	If Rs.eof Then
		Call GoBack("","该版面不存在,可能已经删除了")
		Exit Sub
	Else
		ParentID=Rs(0)
		BoardName=Rs(1)
		BoardType=Rs(2)
		Introduce=Rs(3)
		BoardImg=Rs(4)
	End IF
	Rs.Close%><form method=POST style="margin:0" action="?Action=SaveEditBoard">
	<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF"  bgcolor='#DEF0FE'><tr  bgcolor="#4D65A4"><td height="25" colspan="2" ><b><font color="#FFFFFF">论坛添加 </font></b></td></tr>
	<tr><td height="40" width="35%"><b>论坛名称:</b><br>论坛版面的名称</td><td height="65%"><input name="BoardID" value="<%=BBS94KK.BoardID%>" type="hidden"><input name="boardname" type=text value="<%=BoardName%>" size=30></td></tr>
	<tr><td height="40"><b>标志图片:</b><br>论坛版面Logo地址,可以不填</td><td><input type=text name="BoardImg" value="<%=BoardImg%>" size=30></td></tr>
	<tr><td height="40"><b>论坛介绍:</b><br>论坛版面描述</td><td><textarea rows="3" name="Introduce"><%=Introduce%></textarea></td></tr>
	<tr><td height="40"><b>属于分类或论坛:</b><br>选择要属于那个分类或那个论坛</td><td><select size="1" name="ParentID"><%=BBS94KK.BoardIDList(ParentID,20)%></select></td></tr>
	<tr><td height="40"><b>论坛类型:</b><br>请选择论坛版面类型</td><td>
	<input type="radio" value="0" name="BoardType" <%If BoardType=0 Then%>checked<%End If%>>普通论坛(用户和游客可以自由的进入)<br>
	<input type="radio" value="1" name="Boardtype" <%If BoardType=1 Then%>checked<%End If%>>会员论坛(只有注册用户才能浏览帖子)<br>
	<input type="radio" value="2" name="Boardtype" <%If BoardType=2 Then%>checked<%End If%>>只读论坛(只能浏览帖子,只有管理员和版主能操作)<br>
	<input type="radio" value="3" name="Boardtype" <%If BoardType=3 Then%>checked<%End If%>>认证论坛(只有版主认证的注册用户才能进入)<br>
	<input type="radio" value="4" name="Boardtype" <%If BoardType=4 Then%>checked<%End If%>>VIP论坛(只有vip用户方能进入)</tr>
	<tr bgcolor="#4D65A4"><td colspan="2"  align="center"><input type="submit" value=" 提 交 ">&nbsp;&nbsp;<input type="reset" value=" 重 置 "></td></tr></table>
	</form>
	<%
End Sub

Sub SaveEditBoard
	'下面的代码看了都累死了,随冰喘了口气,终于完成了。
	Dim BoardID,BoardName,Introduce,BoardType,BoardImg,ParentID,RootID,Depth,Child,Orders,ParentStr,I
	Dim NewParentID,BoardNum,P_Rs
	BoardID=BBS94KK.Fun.GetStr("BoardID")
	BoardName=BBS94KK.Fun.GetStr("BoardName")
	Introduce=BBS94KK.Fun.GetStr("Introduce")
	BoardType=BBS94KK.Fun.GetStr("BoardType")
	BoardImg=BBS94KK.Fun.GetStr("BoardImg")
	NewParentID=BBS94KK.Fun.GetStr("ParentID")
	If Not isnumeric(NewParentID) or Not isnumeric(BoardType) or BoardName="" Or Introduce="" Then
		Call GoBack("",""):Exit Sub
	ElseIF BoardID=NewParentID Then
		Call GoBack("","所属论坛不能指定自己!"):Exit Sub
	End If
	Set Rs=BBS94KK.execute("Select RootID,Depth,Child,Orders,ParentID,ParentStr From[KK_Board] where BoardID="&BoardID)
	IF Rs.Eof or Rs.Bof Then
		Call GoBack("系统出错!","该版面不存在,可能已经删除了!")
		Exit Sub
	End If
	RootID=Rs(0)
	Depth=Rs(1)
	Child=Rs(2)
	Orders=Rs(3)
	ParentID=Rs(4)
	ParentStr=Rs(5)
	Rs.Close
	If ParentID=0 then
		Call GoBack("系统出错!","分类不能设置"):Exit Sub
	ElseIf Int(NewParentID)<>Int(ParentID) Then
		'判断所指定的论坛是否其下属论坛
		Set Rs=BBS94KK.Execute("select BoardID from [KK_board] where ParentStr like '%"&ParentStr&","&BoardID&"%' and BoardID="&NewParentID)
		if not (Rs.eof and Rs.bof) then
			Call GoBack("","您不能指定该版面的下属子论坛作为所属论坛")
			Exit sub
		End if
		Rs.Close
		'获得新选的父级
		Set P_rs=BBS94KK.Execute("select * from [KK_board] where Boardid="&NewParentID)
			If P_rs("Depth")+1> MaxDepth Or (Child>0 And P_Rs("Depth")+2>MaxDepth) Then
			P_rs.Close:Set P_rs=Nothing
			Call GoBack("","本论坛限制了最多只能有" & MaxDepth & "级论坛。如果想使用更多级论坛,请到94KK官方论坛寻求帮助!")
			Exit Sub
		End If		
	End if
	BBS94KK.Execute("Update [KK_Board] Set BoardName='"&BoardName&"',BoardType="&BoardType&",Introduce='"&Introduce&"',BoardImg='"&BoardImg&"' where BoardID="&BoardID&"")
  If Int(NewParentID)<>Int(ParentID) Then
	'将一个分论坛移动到其他分论坛下
	'获得所指定的论坛的相关信息
	'得到其下属版面数
	ParentStr=ParentStr & ","
	BoardNum=BBS94KK.Execute("select count(*) from [KK_Board] where ParentStr like '%"&ParentStr & BoardID&"%'")(0)
	If Isnull(BoardNum) Then BoardNum=1
	'在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
	BBS94KK.Execute("update [KK_Board] set orders=Orders + "&BoardNum&"+1  where RootID="&P_rs("RootID")&" And orders>"&P_rs("orders")&"")
	'更新当前版面数据
	If P_rs("parentstr")="0" Then
	BBS94KK.Execute("update [KK_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)
	Else
	BBS94KK.Execute("update [KK_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)
	End If
	Dim TempParentStr
	i=1
	'更新下属,同时获得移动总数i
	'如果有则更新下属版面数据
	'深度为原有深度加上当前所属论坛的深度
	Set Rs=BBS94KK.Execute("select * from [KK_Board] where ParentStr like '%"&ParentStr & BoardID&"%' order by orders")
	Do while not rs.eof
	i=i+1
	If P_rs("parentstr")="0" Then'如果其父级为类,那么其下属的版面数据
		TempParentStr=P_rs("boardid") & "," & Replace(rs("parentstr"),ParentStr,"")
	Else
		TempParentStr=P_rs("parentstr") & "," & P_rs("boardID") & "," & replace(Rs("Parentstr"),ParentStr,"")
	End If
	BBS94KK.Execute("update [KK_Board] set depth=depth+"&P_rs("depth")&"-"&depth&"+1,orders="&P_rs("orders")&"+"&I&",Rootid="&P_rs("Rootid")&",ParentStr='"&TempParentStr&"' where BoardID="&Rs("BoardID"))
	Rs.movenext
	Loop
	Rs.Close
	Dim TempParentID,II
	TempParentID=NewParentID
	If RootID=P_rs("RootID") then'在同一分类下移动
		'更新所指向的上级论坛版面数,i为本次移动过来的版面数
		'更新其父类版面数
		BBS94KK.Execute("update [KK_Board] set Child=child+"&i&" where (not ParentID=0) and BoardID="&TempParentID)
		For II=1 to P_Rs("depth")
			'得到其父类的父类的版面ID
			Set Rs=BBS94KK.Execute("Select ParentID from [KK_Board] where (not ParentID=0) and BoardID="&TempParentID)
			If Not (rs.eof and rs.bof) then
				TempParentid=Rs(0)
				'更新其父类的父类版面数
			BBS94KK.Execute("update [KK_Board] set Child=child+"&i&" where (not ParentID=0) and BoardID="&TempParentID)
			''''BBS94KK.Execute("update [KK_Board] set Child=child+"&i&" where (not ParentID=0) and boardid in ())
			End if
		Next
		'更新其原父类版面数
		BBS94KK.Execute("update [KK_Board] set Child=child-"&i&" where (not ParentID=0) and BoardID="&ParentID)
		'更新其原来所属论坛数据
		For II=1 to Depth
			'得到其原父类的父类的版面ID
			Set rs=BBS94KK.Execute("select ParentID from [KK_Board] where (not ParentID=0) and BoardID="&ParentID)
			if not (rs.eof and rs.bof) then
				ParentID=rs(0)
				'更新其原父类的父类版面数
				BBS94KK.Execute("update [KK_Board] set child=child-"&i&" where (not ParentID=0) and  boardid="&ParentID)
			End IF
		Next
	Else
	'更新所指向的上级论坛版面数,i为本次移动过来的版面数
	'更新其父类版面数
		BBS94KK.Execute("update [KK_Board] set Child=child+"&i&" where BoardID="&TempParentID)
		For II=1 to P_Rs("depth")
			'得到其父类的父类的版面ID
			Set Rs=BBS94KK.Execute("Select ParentID from [KK_Board] where BoardID="&TempParentID)
			If Not (rs.eof and rs.bof) then
				TempParentid=Rs(0)
				'更新其父类的父类版面数
			BBS94KK.Execute("update [KK_Board] set Child=child+"&i&" where  BoardID="&TempParentID)
			End if
		Next
	'更新其原父类版面数
	BBS94KK.Execute("update [KK_Board] set Child=child-"&i&" where BoardID="&ParentID)
	'更新其原父类的其它版面排序
	BBS94KK.Execute("Update [KK_Board] Set Orders=Orders-"&i&" where RootID="&RootID&" and Orders>"&Orders)
	'更新其原来所属论坛数据
		For II=1 to Depth
			'得到其原父类的父类的版面ID
			Set rs=BBS94KK.Execute("select ParentID from [KK_Board] where BoardID="&ParentID)
			if not (rs.eof and rs.bof) then
				ParentID=rs(0)
				'更新其原父类的父类版面数
				BBS94KK.Execute("update [KK_Board] set child=child-"&i&" where boardid="&ParentID)
			End IF
		Next
	End if
	P_rs.Close:Set P_rs=Nothing
  End If
	Call Suc("","论坛修改成功 !","Admin_Board.asp")	
	UpdateBoardCache
End Sub

Sub DelBoard
	Dim AllTable,I,II,Depth,ParentID,RootID,Orders
	Set Rs=BBS94KK.Execute("Select Depth,ParentID,RootID,Orders,Child From[KK_Board] where BoardID="&BBS94KK.BoardID)
	If Rs.Eof Then 
		Call Goback("系统出错","不存在,论坛可能已经删除了 !")
		Exit Sub
	ElseIf Rs(4)>0 Then
		Call Goback("系统出错","该论坛含有属下论坛,不能删除 !")
		Exit sub
	Else
		Depth=Rs(0)
		ParentID=Rs(1)
		RootID=Rs(2)
		Orders=Rs(3)
	End If
	Rs.Close
	AllTable=Split(BBS94KK.BBSTable(0),",")
	For i=0 To uBound(AllTable)
		BBS94KK.Execute("Delete from [KK_Bbs"&AllTable(i)&"] where BoardID="&BBS94KK.BoardID&"")
	Next

	Set Rs=BBS94KK.Execute("Select TopicID From[KK_Topic] where BoardID="&BBS94KK.BoardID&" And IsVote ")
	Do While Not Rs.Eof
		BBS94KK.Execute("Delete from [KK_TopicVote] where TopicID="&Rs(0))
		BBS94KK.Execute("Delete from [KK_TopicVoteUser] where TopicID="&Rs(0))
	Rs.MoveNext
	Loop
	Rs.Close
	'删除主题记录
	BBS94KK.Execute("Delete From[KK_Topic] where BoardID="&BBS94KK.BoardID)
	BBS94KK.Execute("Delete From[KK_Board] where BoardID="&BBS94KK.BoardID)
	'更新其父类的版面数
	BBS94KK.Execute("update [KK_Board] set Child=child-1 where BoardID="&ParentID)
	'更新其父类的其它版面排序
	BBS94KK.Execute("Update [KK_Board] Set Orders=Orders-1 where RootID="&RootID&" and Orders>"&Orders)
	'更新其所属论坛数据
		For II=1 to Depth
			'得到其父类的父类的版面ID
			Set rs=BBS94KK.Execute("select ParentID from [KK_Board] where BoardID="&ParentID)
			if not (rs.eof and rs.bof) then
				ParentID=rs(0)
				'更新其父类的父类版面数
				BBS94KK.Execute("update [KK_Board] set child=child-1 where boardid="&ParentID)
			End IF
			Rs.Close
		Next
	Call Suc("","成功的删除论坛版面 (包括该论坛的所有帖子)!","Admin_Board.asp")	
	UpdateBoardCache
End Sub

Sub ClassOrders
	Dim BoardID
	Set Rs=BBS94KK.Execute("Select BoardID,BoardName,RootID from[KK_Board] where Depth=0 order by RootID")
	If Rs.Eof Then
		Call GoBack("","论坛没有分类!请先<a href=?Action=AddClass> 添加分类</a>")
		Exit Sub
	End If
	%><form method=POST style="margin:0" action="?Action=SaveClassOrders">
	<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bgcolor='#DEF0FE' bordercolordark="#FFFFFF"><tr  bgcolor="#4D65A4"><td height="25" colspan="2" ><b><font color="#FFFFFF">分类排序 </font></b></td></tr>
	<tr><td height="25" colspan="2" align="center">排序方式按从小到大排序,请用数字填写,排序数字不能相同。</td></tr>
	<%
	Do while not rs.eof
	Response.Write"<tr><td height='25'>&nbsp;"&Rs(1)&"</td><td><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 ></td></tr>"
	Rs.MoveNext
	Loop
	%>
	<tr bgcolor="#4D65A4"><td colspan="2"  align="center"><input type="submit" value=" 修 改 ">&nbsp;&nbsp;<input type="reset" value=" 重 置 "></td></tr></table></form>
	<%Rs.Close
End Sub

Sub SaveClassOrders
	Dim BoardID,RootID,NewRootID,Temp,I
	Temp=","
	For i=1 to request.form("BoardID").count
		BoardID = request.form("BoardID")(i)
		RootID = request.form("RootID")(i)
		NewRootID = request.form("NewRootID")(i)
		If InStr(Temp,","&NewRootID&",")>0 Then 
			Call GoBack("排序错误","各分类排序的数字不能一样!")
			Exit Sub
		End If
		Temp=Temp&NewRootID&","
		IF Not IsNumeric(BoardID) or Not isnumeric(NewRootID) Then
			Call GoBack("排序错误","请用数字填写!")
			Exit Sub
		End IF
	Next
	For i=1 to request.form("BoardID").count
		BoardID = request.form("BoardID")(i)
		RootID = request.form("RootID")(i)
		NewRootID = request.form("NewRootID")(i)
		If RootID<>NewRootID Then
			BBS94KK.Execute("Update [KK_Board]Set RootID="&NewRootID&" where BoardID="&BoardID)
			Temp=BoardID
			BBS94KK.Execute("Update [KK_Board] Set RootID="&NewRootID&" where ParentStr like '%"&Temp&"%' And RootID="&RootID&"")
		End If
	Next
	Call Suc("","排序成功!","?")	
	UpdateBoardCache
End Sub


Sub BoardUnite
	%><form method=POST style="margin:0" action="?Action=SaveBoardUnite">
	<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE"><tbody>
	<tr bgcolor="#4D65A4"><td height="25"><b><font color="#FFFFFF">论坛合并</font></b></td></tr>
	<tr><td height="40">将论坛: <select size="1" name="BoardID"><option value='0'>请选择原论坛</option><%=BBS94KK.BoardIDList(0,0)%></select> 合并到论坛: <select size="1" name="NewBoardID"><option value='0'>请选择目标论坛</option><%=BBS94KK.BoardIDList(0,0)%></select> 中 <input type="submit" onclick=checkclick('操作后将不能恢复!您确定要合并吗?') value=" 论坛合并 "></td></tr>
	<tr bgcolor="#E8F4EF"><td height="40" ><b>注意事项:</b><font color=red>此操作不可恢复,请慎重操作!</font><br>
	分类不能操作,不能和其属下的论坛合并。<br>
	合并后原论坛(包括属下论坛)将被删除,所有帖子(包括属下论坛的帖子)将转移到指定的目标论坛中 </td></tr></table></form>
	<%
End Sub

Sub SaveBoardUnite
	Dim BoardID,NewBoardID,TempParentStr,TempParentID,Rs1
	Dim I,AllTable
	Dim ParentStr,Depth,ParentID,Child,RootID
	BoardID=BBS94KK.Fun.Getstr("BoardID")
	NewBoardID=BBS94KK.Fun.Getstr("NewBoardID")
	IF BoardID="" Or NewBoardID="" Then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -