📄 admin_board.asp
字号:
<%
rs.close
set rs=nothing
set rs_c=nothing
end sub
sub mode()
dim boarduser
%>
<form action ="admin_board.asp?action=savemod" method=post>
<table width="95%" class="tableBorder" cellspacing="1" cellpadding="1" align="center">
<tr bgcolor=<%=Forum_body(3)%>>
<th width="52%" height=22>说明:</th>
<th width="48%">操作:</th>
</tr>
<tr>
<td width="52%" height=22 class=forumrow><B>论坛名称</B></td>
<td width="48%" class=forumrow>
<%
set rs= server.CreateObject ("adodb.recordset")
sql="select boardid,boardtype,boarduser from board where boardid="&request("boardid")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "该版面并不存在或者该版面不是加密版面。"
else
response.write rs(1)
response.write "<input type=hidden value="&rs(0)&" name=boardid>"
boarduser=rs(2)
end if
rs.close
set rs=nothing
%>
</td>
</tr>
<tr>
<td width="52%" class=forumrow><B>认证用户</B>:<br>
只有设定为认证论坛的论坛需要填写能够进入该版面的用户,每输入一个用户请确认用户名在论坛中存在,每个用户名用<B>回车</B>分开</font>
</td>
<td width="48%" class=forumrow>
<textarea cols=35 rows=6 name="vipuser">
<%
if not isnull(boarduser) or boarduser<>"" then
response.write replace(boarduser,",",chr(10))
end if
%>
</textarea>
</td>
</tr>
<tr>
<td width="52%" height=22 class=forumrow> </td>
<td width="48%" class=forumrow>
<input type="submit" name="Submit" value="设 定">
</td>
</tr>
</table>
</form>
<%
end sub
'保存编辑论坛认证用户信息
'入口:用户列表字符串
sub savemod()
dim boarduser
dim boarduser_1
dim userlen
dim updateinfo
response.write "<p>论坛设置成功!<br><br>"
if trim(request("vipuser"))<>"" then
boarduser=request("vipuser")
boarduser=split(boarduser,chr(13)&chr(10))
for i = 0 to ubound(boarduser)
if not (boarduser(i)="" or boarduser(i)=" ") then
boarduser_1=""&boarduser_1&""&boarduser(i)&","
end if
next
userlen=len(boarduser_1)
if boarduser_1<>"" then
boarduser=left(boarduser_1,userlen-1)
response.write "<p>添加用户:"&boarduser&"<br><br>"
updateinfo=" boarduser='"&boarduser&"' "
else
response.write "<p><font color=red>你没有添加认证用户</font><br><br>"
end if
end if
conn.execute("update board set "&updateinfo&" where boardid="&request("boardid"))
end sub
'保存添加论坛信息
sub savenew()
if request("boardtype")="" then
Errmsg=Errmsg+"<br>"+"<li>请输入论坛名称。"
Founderr=true
end if
if request("class")="" then
Errmsg=Errmsg+"<br>"+"<li>请选择论坛分类。"
Founderr=true
end if
if request("readme")="" then
Errmsg=Errmsg+"<br>"+"<li>请输入论坛说明。"
Founderr=true
end if
if founderr=true then
response.write Errmsg
exit sub
end if
dim boardid
dim rootid
dim parentid
dim depth
dim orders
dim Fboardmaster
dim maxrootid
dim parentstr
if request("class")<>"0" then
set rs=conn.execute("select rootid,boardid,depth,orders,boardmaster,ParentStr from board where boardid="&request("class"))
rootid=rs(0)
parentid=rs(1)
depth=rs(2)
orders=rs(3)
if depth+1>20 then
response.write "本论坛限制最多只能有20级分类"
exit sub
end if
parentstr=rs(5)
else
set rs=conn.execute("select max(rootid) from board")
maxrootid=rs(0)+1
if isnull(MaxRootID) then MaxRootID=1
end if
sql="select boardid from board where boardid="&request("newboardid")
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
response.write "您不能指定和别的论坛一样的序号。"
exit sub
else
boardid=request("newboardid")
end if
set rs = server.CreateObject ("adodb.recordset")
sql = "select * from board"
rs.Open sql,conn,1,3
rs.AddNew
if request("class")<>"0" then
rs("depth")=depth+1
rs("rootid")=rootid
rs("orders") = Request.form("newboardid")
rs("parentid") = Request.Form("class")
if ParentStr="0" then
rs("ParentStr")=Request.Form("class")
else
rs("ParentStr")=ParentStr & "," & Request.Form("class")
end if
else
rs("depth")=0
rs("rootid")=maxrootid
rs("orders")=0
rs("parentid")=0
rs("child")=0
rs("parentstr")=0
end if
rs("boardid") = Request.form("newboardid")
rs("boardtype") = Request.Form("boardtype")
rs("readme") = Request.form("readme")
rs("lasttopicnum") = 0
rs("lastbbsnum") = 0
rs("lasttopicnum") = 0
rs("todaynum") = 0
rs("LastPost")="$0$"&Now()&"$$$$$"
rs("Board_Setting")="0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,16240,3,300,gif|jpg|jpeg|bmp|png|rar|txt|zip|mid,0,0,0|24,1,0,300,20,10,9,12,1,10,10,0,0,0,0,1,5,0,1,4,0,0,0,0,0,0,0,0,0"
rs("sid")=request.form("sid")
if Request("boardmaster")<>"" then
rs("boardmaster") = Request.form("boardmaster")
end if
if request.form("indexIMG")<>"" then
rs("indexIMG")=request.form("indexIMG")
end if
rs.Update
rs.Close
if Request("boardmaster")<>"" then call addmaster(Request("boardmaster"),"none",0)
if request("class")<>"0" then
if depth>0 then
'当上级分类深度大于0的时候要更新其父类(或父类的父类)的版面数和相关排序
for i=1 to depth
'更新其父类版面数
if parentid<>"" then
conn.execute("update board set child=child+1 where boardid="&parentid)
end if
'得到其父类的父类的版面ID
set rs=conn.execute("select parentid from board where boardid="&parentid)
if not (rs.eof and rs.bof) then
parentid=rs(0)
end if
'当循环次数大于1并且运行到最后一次循环的时候直接进行更新
if i=depth and parentid<>"" then
conn.execute("update board set child=child+1 where boardid="&parentid)
end if
next
'更新该版面排序以及大于本需要和同在本分类下的版面排序序号
conn.execute("update board set orders=orders+1 where rootid="&rootid&" and orders>"&orders)
conn.execute("update board set orders="&orders&"+1 where boardid="&Request.form("newboardid"))
else
'当上级分类深度为0的时候只要更新上级分类版面数和该版面排序序号即可
conn.execute("update board set child=child+1 where boardid="&request("class"))
set rs=conn.execute("select max(orders) from board where boardid="&Request.form("newboardid"))
conn.execute("update board set orders="&rs(0)&"+1 where boardid="&Request.form("newboardid"))
end if
end if
response.write "<p>论坛添加成功!<br><B>该论坛目前高级设置为默认选项,建议您返回论坛管理中心重新设置该论坛的高级选项</B><BR><br>"&str
set rs=nothing
call cache_board()
end sub
'保存编辑论坛信息
sub savedit()
if clng(request("editid"))=clng(request("class")) then
response.write "所属论坛不能指定自己"
exit sub
end if
dim newboardid,maxrootid
dim parentid,boardmaster,depth,child,ParentStr,rootid,iparentid,iParentStr
dim trs,brs,mrs
set rs = server.CreateObject ("adodb.recordset")
sql = "select * from board where boardid="&request("editid")
rs.Open sql,conn,1,3
newboardid=rs("boardid")
parentid=rs("parentid")
iparentid=rs("parentid")
boardmaster=rs("boardmaster")
ParentStr=rs("ParentStr")
depth=rs("depth")
child=rs("child")
rootid=rs("rootid")
'判断所指定的论坛是否其下属论坛
if ParentID=0 then
if clng(request("class"))<>0 then
set trs=conn.execute("select rootid from board where boardid="&request("class"))
if rootid=trs(0) then
response.write "您不能指定该版面的下属论坛作为所属论坛"
exit sub
end if
end if
else
set trs=conn.execute("select boardid from board where ParentStr like '%"&ParentStr&"%' and boardid="&request("class"))
if not (trs.eof and trs.bof) then
response.write "您不能指定该版面的下属论坛作为所属论坛"
response.end
end if
end if
if parentid=0 then
parentid=rs("boardid")
iparentid=0
end if
rs("boardtype") = Request.Form("boardtype")
'rs("parentid") = Request.Form("class")
rs("boardmaster") = Request("boardmaster")
rs("readme") = Request("readme")
rs("indexIMG")=request.form("indexIMG")
rs("sid")=request.form("sid")
rs.Update
rs.Close
set rs=nothing
if request("oldboardmaster")<>Request("boardmaster") then call addmaster(Request("boardmaster"),request("oldboardmaster"),1)
set mrs=conn.execute("select max(rootid) from board")
Maxrootid=mrs(0)+1
'假如更改了所属论坛
'需要更新其原来所属版面信息,包括深度、父级ID、版面数、排序、继承版主等数据
'需要更新当前所属版面信息
'继承版主数据需要另写函数进行更新--取消,在前台可用boardid in parentstr来获得
dim k,nParentStr,mParentStr
dim ParentSql,boardcount
if clng(parentid)<>clng(request("class")) and not (iparentid=0 and cint(request("class"))=0) then
'如果原来不是一级分类改成一级分类
if iparentid>0 and cint(request("class"))=0 then
'更新当前版面数据
conn.execute("update board set depth=0,orders=0,rootid="&maxrootid&",parentid=0,parentstr='0' where boardid="&newboardid)
ParentStr=ParentStr & ","
set rs=conn.execute("select count(*) from board where ParentStr like '%"&ParentStr&"%'")
boardcount=rs(0)
if isnull(boardcount) then
boardcount=1
else
boardcount=boardcount+1
end if
'更新其原来所属论坛版面数
conn.execute("update board set child=child-"&boardcount&" where boardid="&iparentid)
'更新其原来所属论坛数据,排序相当于剪枝而不需考虑
for i=1 to depth
'得到其父类的父类的版面ID
set rs=conn.execute("select parentid from board where boardid="&iparentid)
if not (rs.eof and rs.bof) then
iparentid=rs(0)
conn.execute("update board set child=child-"&boardcount&" where boardid="&iparentid)
end if
next
if child>0 then
'更新其下属论坛数据
'有下属论坛,排序不需考虑,更新下属论坛深度和一级排序ID(rootid)数据
'更新当前版面数据
'ParentStr=ParentStr & ","
i=0
set rs=conn.execute("select * from board where ParentStr like '%"&ParentStr&"%'")
do while not rs.eof
i=i+1
mParentStr=replace(rs("ParentStr"),ParentStr,"")
conn.execute("update board set depth=depth-"&depth&",rootid="&maxrootid&",ParentStr='"&mParentStr&"' where boardid="&rs("boardid"))
rs.movenext
loop
end if
elseif iparentid>0 and cint(request("class"))>0 then
'将一个分论坛移动到其他分论坛下
'获得所指定的论坛的相关信息
set trs=conn.execute("select * from board where boardid="&request("class"))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -