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

📄 admin_board.asp

📁 功能强大的bbs
💻 ASP
📖 第 1 页 / 共 5 页
字号:
	response.write "</table>"
end if
rs.close
set rs=nothing
%>
	</td>
	</tr>
</table>
<%
end sub

sub updateboardorders()
dim ParentID,orders,ParentStr,child
dim uporders,doorders,oldorders,trs,ii
if not isnumeric(request("editID")) then
	response.write "非法的参数!"
	exit sub
end if
if request("uporders")<>"" and not Cint(request("uporders"))=0 then
	if not isnumeric(request("uporders")) then
	response.write "非法的参数!"
	exit sub
	elseif Cint(request("uporders"))=0 then
	response.write "请选择要提升的数字!"
	exit sub
	end if
	'向上移动
	'要移动的论坛信息 shinzeal加入rootid和depth作为更新所有相关版面的依据
	dim rootid,depth
	set rs=Dvbbs.Execute("select ParentID,orders,ParentStr,child,rootid,depth from dv_board where boardid="&request("editID"))
	ParentID=rs(0)
	orders=rs(1)
	ParentStr=rs(2) & "," & request("editID")
	child=rs(3)
	rootid=rs(4)
	depth=rs(5)
	i=0
	'response.write "select boardid,orders from dv_board where ParentID="&ParentID&" and orders<"&orders&" order by orders desc<br>"
	if child>0 then
	set rs=Dvbbs.Execute("select count(*) from dv_board where ParentStr like '%"&ParentStr&"%' and rootid="&rootid)
	oldorders=rs(0)
	else
	oldorders=0
	end if
'shinzeal加入变量shin和shinlast记录更新后版面最大的orders
	dim shin,shinlast
	shin=0
	shinlast=0
	'和该论坛同级且排序在其之上的论坛-更新其排序,最末者为当前论坛排序号
	set rs=Dvbbs.Execute("select boardid,orders,child,ParentStr from dv_board where ParentID="&ParentID&" and orders<"&orders&" order by orders desc")
	do while not rs.eof
	i=i+1
	if Cint(request("uporders"))>=i then
		'response.write "update dv_board set orders="&orders&" where boardid="&rs(0)&"<br>"
		if rs(2)>0 then
		ii=0
		set trs=Dvbbs.Execute("select boardid,orders from dv_board where ParentStr like '%"&rs(3)&","&rs(0)&"%' order by orders")
		if not (trs.eof and trs.bof) then
		do while not trs.eof
		ii=ii+1
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&oldorders&"+"&ii&" where boardid="&trs(0))
		shin=orders+oldorders+ii
		if shin>shinlast then shinlast=shin
		trs.movenext
		loop
		end if
		end if
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&oldorders&" where boardid="&rs(0))
		shin=orders+oldorders
		if shin>shinlast then shinlast=shin
		if Cint(request("uporders"))=i then uporders=rs(1)
	end if
	orders=rs(1)
	rs.movenext
	loop
	'response.write "update dv_board set orders="&uporders&" where boardid="&request("editID")
	'更新所要排序的论坛的序号
	Dvbbs.Execute("update dv_board set orders="&uporders&" where boardid="&request("editID"))
	'如果有下属论坛,则更新其下属论坛排序
	if child>0 then
	i=uporders
	set rs=Dvbbs.Execute("select boardid from dv_board where ParentStr like '%"&ParentStr&"%' and depth>"&depth&" order by orders")
	do while not rs.eof
	i=i+1
	Dvbbs.Execute("update dv_board set orders="&i&" where boardid="&rs(0))
	shin=i
	if shin>shinlast then shinlast=shin
	rs.movenext
	loop
	end if
	'response.end
'shinzeal加入更新被提升论坛之下所有同级论坛的orders,避免和被更新论坛的下级论坛重复
	dim shin1,shinlast1
	shin1=0
	shinlast1=0
	set rs=Dvbbs.Execute("select boardid,orders,child,ParentStr from dv_board where ParentID="&ParentID&" and orders>"&uporders&" order by orders")
	do while not rs.eof
		if rs(2)>0 then
		ii=0
		set trs=Dvbbs.Execute("select boardid,orders from dv_board where ParentStr like '%"&rs(3)&","&rs(0)&"%' order by orders")
		if not (trs.eof and trs.bof) then
		do while not trs.eof
		ii=ii+1
		'response.write "update dv_board set orders="&orders&"+"&ii&" where boardid="&trs(0)&"-a<br>"
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&ii&"+"&shinlast&" where boardid="&trs(0))
		shin1=orders+oldorders+ii+shinlast
		if shin1>shinlast1 then shinlast1=shin1
		trs.movenext
		loop
		end if
		end if
		'response.write "update dv_board set orders="&orders&" where boardid="&rs(0)&"<br>"
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&shinlast&" where boardid="&rs(0))
		shin1=orders+oldorders+shinlast
		if shin1>shinlast1 then shinlast1=shin1
	orders=rs(1)
	rs.movenext
	loop
'shinzeal加入更新被提升论坛上一级的orders在被更新论坛之后的论坛orders,防止orders互相交叉
	set rs=Dvbbs.Execute("select boardid,orders,child,ParentStr from dv_board where rootID="&rootID&" and orders>"&uporders&" and depth<"&depth&" order by orders")
	do while not rs.eof
		if rs(2)>0 then
		ii=0
		set trs=Dvbbs.Execute("select boardid,orders from dv_board where ParentStr like '%"&rs(3)&","&rs(0)&"%' order by orders")
		if not (trs.eof and trs.bof) then
		do while not trs.eof
		ii=ii+1
		'response.write "update dv_board set orders="&orders&"+"&ii&" where boardid="&trs(0)&"-a<br>"
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&ii&"+"&shinlast1&" where boardid="&trs(0))
		trs.movenext
		loop
		end if
		end if
		'response.write "update dv_board set orders="&orders&" where boardid="&rs(0)&"<br>"
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&shinlast1&" where boardid="&rs(0))
	orders=rs(1)
	rs.movenext
	loop
'shinzeal对提升论坛的更新结束
	set rs=nothing
	set trs=nothing
elseif request("doorders")<>"" then
	if not isnumeric(request("doorders")) then
	response.write "非法的参数!"
	exit sub
	elseif Cint(request("doorders"))=0 then
	response.write "请选择要下降的数字!"
	exit sub
	end if
'要移动的论坛信息 shinzeal加入rootid和depth作为更新所有相关版面的依据
	set rs=Dvbbs.Execute("select ParentID,orders,ParentStr,child,rootid,depth from dv_board where boardid="&request("editID"))
	ParentID=rs(0)
	orders=rs(1)
	ParentStr=rs(2) & "," & request("editID")
	child=rs(3)
	rootid=rs(4)
	depth=rs(5)
	i=0
	shin=0
	shinlast=0
	set rs=Dvbbs.Execute("select boardid,orders,child,ParentStr from dv_board where ParentID="&ParentID&" and orders>"&orders&" order by orders")
	do while not rs.eof
	i=i+1
	if Cint(request("doorders"))>=i then
		if rs(2)>0 then
		ii=0
		set trs=Dvbbs.Execute("select boardid,orders from dv_board where ParentStr like '%"&rs(3)&","&rs(0)&"%' order by orders")
		if not (trs.eof and trs.bof) then
		do while not trs.eof
		ii=ii+1
		'response.write "update dv_board set orders="&orders&"+"&ii&" where boardid="&trs(0)&"-a<br>"
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&ii&" where boardid="&trs(0))
		shin=orders+ii
		if shin>shinlast then shinlast=shin
		trs.movenext
		loop
		end if
		end if
		'response.write "update dv_board set orders="&orders&" where boardid="&rs(0)&"<br>"
		Dvbbs.Execute("update dv_board set orders="&orders&" where boardid="&rs(0))
		shin=orders
		if shin>shinlast then shinlast=shin
		if Cint(request("doorders"))=i then doorders=rs(1)
	end if
	orders=rs(1)
	rs.movenext
	loop
	'response.write "update dv_board set orders="&doorders&" where boardid="&request("editID")&"<br>"
	Dvbbs.Execute("update dv_board set orders="&shinlast+1&" where boardid="&request("editID"))
	'如果有下属论坛,则更新其下属论坛排序
	if child>0 then
	i=shinlast+1
	set rs=Dvbbs.Execute("select boardid from dv_board where ParentStr like '%"&ParentStr&"%' and depth>"&depth&" order by orders")
	do while not rs.eof
	i=i+1
	'response.write "update dv_board set orders="&i&" where boardid="&rs(0)&"-b<br>"
	Dvbbs.Execute("update dv_board set orders="&i&" where boardid="&rs(0))
	shin=i
	if shin>shinlast then shinlast=shin
	rs.movenext
	loop
	end if
	'shinzeal加入更新被下降论坛之下所有同级论坛的orders,避免和被更新论坛的下级论坛重复
	shin1=0
	shinlast1=0
	set rs=Dvbbs.Execute("select boardid,orders,child,ParentStr from dv_board where ParentID="&ParentID&" and orders>"&doorders&" order by orders")
	do while not rs.eof
		orders=rs(1)
		if rs(2)>0 then
		ii=0
		set trs=Dvbbs.Execute("select boardid,orders from dv_board where ParentStr like '%"&rs(3)&","&rs(0)&"%' order by orders")
		if not (trs.eof and trs.bof) then
		do while not trs.eof
		ii=ii+1
		'response.write "update dv_board set orders="&orders&"+"&ii&" where boardid="&trs(0)&"-a<br>"
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&ii&"+"&shinlast&" where boardid="&trs(0))
		shin1=orders+ii+shinlast
		if shin1>shinlast1 then shinlast1=shin1
		trs.movenext
		loop
		end if
		end if
		'response.write "update dv_board set orders="&orders&" where boardid="&rs(0)&"<br>"
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&shinlast&" where boardid="&rs(0))
		shin1=orders+shinlast
		if shin1>shinlast1 then shinlast1=shin1
	rs.movenext
	loop
'shinzeal加入更新被下降论坛上一级的orders在被更新论坛之后的论坛orders,防止orders互相交叉
	set rs=Dvbbs.Execute("select boardid,orders,child,ParentStr from dv_board where rootID="&rootID&" and orders>"&doorders&" and depth<"&depth&" order by orders")
	do while not rs.eof
		orders=rs(1)
		if rs(2)>0 then
		ii=0
		set trs=Dvbbs.Execute("select boardid,orders from dv_board where ParentStr like '%"&rs(3)&","&rs(0)&"%' order by orders")
		if not (trs.eof and trs.bof) then
		do while not trs.eof
		ii=ii+1
		'response.write "update dv_board set orders="&orders&"+"&ii&" where boardid="&trs(0)&"-a<br>"
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&ii&"+"&shinlast1&" where boardid="&trs(0))
		trs.movenext
		loop
		end if
		end if
		'response.write "update dv_board set orders="&orders&" where boardid="&rs(0)&"<br>"
		Dvbbs.Execute("update dv_board set orders="&orders&"+"&shinlast1&" where boardid="&rs(0))
	rs.movenext
	loop
'shinzeal对下降论坛的更新结束
	'response.end
	set rs=nothing
	set trs=nothing
end if
Dvbbs.ReloadAllBoardInfo()
Dvbbs.Name="setup"
Dvbbs.ReloadSetup
Dvbbs.CacheData=Dvbbs.value

Set tRs=Dvbbs.Execute("Select RootID From Dv_Board Where BoardID="&request("editid"))
Dim UpdateRootID
UpdateRootID = tRs(0)

Set tRs=dvbbs.Execute("Select BoardID From Dv_Board Where RootID="&UpdateRootID&" Order By Orders")
Do While Not tRs.Eof
	Dvbbs.ReloadBoardInfo(tRs(0))
tRs.Movenext
Loop
Set tRs=Nothing
'Dvbbs.ReloadBoardInfo(request("editid"))

Dvbbs.DelCahe "BoardJumpList"
Dvbbs.DelCahe "MyAllBoardList"

response.redirect "admin_board.asp?action=boardorders"
end sub

Sub Addmaster(s,o,n)
	Dim Arr, Pw, Oarr
	Dim Classname, Titlepic
	Set Rs = Dvbbs.Execute("SELECT Usertitle, GroupPic FROM Dv_Usergroups WHERE Usergroupid = 3 ORDER BY Minarticle DESC")
	If Not (Rs.Eof And Rs.Bof) Then
		Classname = Rs(0)
		Titlepic = Rs(1)
	End If
	Randomize
	Pw = Cint(Rnd * 9000) + 1000
	Arr = Split(s,"|")
	Oarr = Split(o,"|")
	Set Rs = Server.Createobject("Adodb.Recordset")
	For i = 0 To Ubound(Arr)
		Sql = "SELECT * FROM [Dv_User] WHERE Username = '" & Arr(i) & "'"
		Rs.Open Sql,Conn,1,3
		If Rs.Eof And Rs.Bof Then
			Rs.Addnew
			Rs("Username") = Arr(i)
			Rs("Userpassword") = Md5(Pw,16)
			Rs("Userclass") = Classname
			Rs("UserGroupID") = 3
			Rs("Titlepic") = Titlepic
			Rs("UserWealth") = 100
			Rs("Userep") = 30
			Rs("Usercp") = 30
			Rs("Userisbest") = 0
			Rs("Userdel") = 0
			Rs("Userpower") = 0
			Rs("Lockuser") = 0
			'加入更详细资料使登录与显示资料不会出错。
			Rs("UserSex") = 1
			Rs("UserEmail") = Arr(i) & "@aspsky.net"
			Rs("UserFace") = "Images/userface/image1.gif"
			Rs("UserWidth") = 32
			Rs("UserHeight") = 32
			Rs("UserIM") = "||||||||||||||||||"
			Rs("UserFav") = "陌生人,我的好友,黑名单"
			Rs("LastLogin") = Now()
			Rs("JoinDate") = Now()
			Rs("Userpost") = 0
			Rs("Usertopic") = 0
			Rs.Update
			Str = Str & "你添加了以下用户:<b>" & Arr(i) & "</b> 密码:<b>" & Pw & "</b><br><br>"
			Dvbbs.Execute("UPDATE Dv_Setup SET Forum_Usernum = Forum_Usernum + 1, Forum_Lastuser = '" & Arr(i) & "'")
		Else
			If Rs("UserGroupID") = 4 Then
				Rs("Userclass") = Classname
				Rs("UserGroupID") = 3
				Rs("Titlepic") = Titlepic
				Rs.Update
			End If
		End If
		Rs.Close
	Next
	Dvbbs.Name = "Setup"
	Dvbbs.ReloadSetup
	'判断原版主在其他版面是否还担任版主,如没有担任则撤换该用户职位。
	If n = 1 Then
		Dim Iboardmaster
		Dim UserGrade, Article
		Iboardmaster = False
		For i = 0 To Ubound(Oarr)
			Set Rs = Dvbbs.Execute("SELECT Boardmaster FROM Dv_Board")
			Do While Not Rs.Eof
				If Instr("|" & Trim(Rs("Boardmaster")) & "|","|" & Trim(Oarr(i)) & "|") > 0 Then
					Iboardmaster = True
					Exit Do
				End If
				Rs.Movenext
			Loop
			If Not Iboardmaster Then
				Set Rs = Dvbbs.Execute("SELECT Userid, UserGroupID, UserPost FROM [Dv_User] WHERE Username = '" & Trim(Oar

⌨️ 快捷键说明

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