📄 board.asp
字号:
<!--#include file="check.asp"-->
<%
const maxdepth=3
server.scripttimeout =999999
response.write("<body>")
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>")
response.flush
select case request("action")
case "addclass"
addclass
case "saveclass"
saveclass
case "editclass"
editclass
case "saveeditclass"
saveeditclass
case "delclass"
delclass
case "addboard"
addboard
case "saveboard"
saveboard
case "editboard"
editboard
case "saveeditboard"
saveeditboard
case "delboard"
delboard
case "classorders"
classorders
case "saveclassorders"
saveclassorders
case "boardunite"
boardunite
case "saveboardunite"
saveboardunite
case "passuser"
passuser
case "savepassuser"
savepassuser
case "ordersboard"
ordersboard
case else
boardinfo()
end select
adminfooter()
sub boardinfo
dim rs,brs,i,install,temp,ii,po,boardtype
%>
<div class="ta">
<div class="th1 jz w390">论坛版面</div>
<div class="th1 jz w390">相应操作</div>
<%
set rs=yxbbs.execute("select boardid,boardname,parentid,depth,child,boardtype from [yx_board] order by rootid,orders")
if rs.eof or rs.bof then
call goback("","论坛没有分类!请先<a href=board.asp?action=addclass> 添加分类</a>")
exit sub
end if
brs=rs.getrows(-1)
rs.close
for i=0 to ubound(brs,2)
temp=""
install=" <a href='?action=addboard&boardid="&brs(0,i)&"'>添加论坛</a>"
if brs(3,i)=0 then'分类
temp="<div class=""td1 jz"" style=""text-align: left;"">"&temp
if brs(4,i)>0 then'如果有子论坛
temp=temp&brs(1,i)&" ("&brs(4,i)&")"
else
temp=temp&brs(1,i)
end if
install=install & " | <a href='?action=editclass&boardid="&brs(0,i)&"'>分类改名</a>"
if brs(4,i)>0 then
install=install & " | <a href=javascript:alert('不能删除!该分类含有论坛!\n\n要删除本类,必须先把属下的论坛删除或移走。')>删除分类</a>"
else
install=install & " | <a onclick=checkclick('删除后将不能恢复!您确定要删除吗?') href='?action=delclass&boardid="&brs(0,i)&"'>删除分类</a>"
end if
else'版面
temp="<div class=""td1 jz"" style=""text-align: left;"">"&temp
po=""
for ii=1 to brs(3,i)
po=po&" <font color=red>∣</font> "
next
if brs(4,i)>0 then'如果有子论坛
temp=temp&po&brs(1,i)&" ("&brs(4,i)&")"
else
temp=temp&po&brs(1,i)
end if
install=install & " | <a href='?action=editboard&boardid="&brs(0,i)&"'>修改</a>"
if brs(4,i)>0 then
install=install & " | <a href='javascript:' onclick=alert('不能删除!该版面含有子论坛!\n\n要删除本版,必须先把属下的子论坛删除或移走。')>删除</a>"
else
install=install & " | <a onclick=checkclick('删除后将不能恢复!您确定要删除吗?') href='?action=delboard&boardid="&brs(0,i)&"'>删除</a>"
end if
install=install & " | <a href='?action=ordersboard&boardid="&brs(0,i)&"'>置前</a>"
if brs(5,i) then
install=install & " | <a href='?action=passuser&boardid="&brs(0,i)&"'>认证用户</a>"
end if
end if
response.write(temp&"</div><div class=""td2 jz"" style=""text-align: left;"">"&install&"</div>")
next
%>
<div style='clear: both;'></div>
</div>
<%
end sub
sub addclass
dim newboardid
set rs=yxbbs.execute("select max(boardid) from [yx_board]")
if rs.eof or rs.bof then
newboardid=1
else
newboardid=rs(0)+1
end if
if not isnumeric(newboardid) then newboardid=1
rs.close
%><form method=post style="margin:0" action="?action=saveclass">
<div class="ta">
<div class="th jz">添加分类</div>
<div class="td1 h30"><b>分类名称:</b><br />论坛的分类名称</div>
<div class="td2 h30" style="text-align: left;"><input name="newboardid" type="hidden" value="<%=newboardid%>"><input type=text name="boardname" size=30></div>
<div style="clear: both;"></div><div class="tf jz"><input type="submit" value=" 提 交 "> <input type="reset" value=" 重 置 "></div></form> </div>
<%
end sub
sub saveclass
dim boardname,newboardid,maxrootid
boardname=yxbbs.fun.getstr("boardname")
newboardid=yxbbs.fun.getstr("newboardid")
if boardname="" or not isnumeric(newboardid) then
call goback("",""):exit sub
else
set rs=yxbbs.execute("select boardid from [yx_board] where boardid="&newboardid)
if not (rs.eof and rs.bof) then
call goback("错误提示","不能指定和别的论坛一样的序号!")
exit sub
end if
rs.close
set rs=yxbbs.execute("select max(rootid) from yx_board")
maxrootid=rs(0)+1
if isnull(maxrootid) then maxrootid=1
rs.close
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')")
call suc("","成功的添加了论坛分类 <b>"&boardname&"</b> !","?")
end if
end sub
sub editclass
dim boardid
set rs=yxbbs.execute("select boardname from[yx_board] where boardid="&yxbbs.boardid&"")
if rs.eof then
call goback("系统出错","论坛找不到这个分类,可能已经删除了。"):exit sub
end if
%><form method=post style="margin:0" action="?action=saveeditclass">
<div class="ta">
<div class="th jz">添加分类</div>
<div class="td1 h30"><b>分类名称:</b><br />论坛的分类名称</div>
<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>
<div style="clear: both;"></div><div class="tf"><input type="submit" value=" 提 交 "> <input type="reset" value=" 重 置 "></div></form></div>
<%rs.close
end sub
sub saveeditclass
dim boardname,boardid
boardname=yxbbs.fun.getstr("boardname")
boardid=yxbbs.fun.getstr("boardid")
if boardname="" or not isnumeric(boardid) then
call goback("",""):exit sub
else
if yxbbs.execute("select boardid from [yx_board] where boardid="&boardid).eof then
call goback("系统出错","论坛找不到这个分类,可能已经删除了。"):exit sub
end if
yxbbs.execute("update [yx_board] set boardname='"&boardname&"' where boardid="&boardid)
call suc("","成功的把论坛分类名称改为 <b>"&boardname&"</b> !","?")
end if
end sub
sub delclass
if yxbbs.execute("select count(boardid) from[yx_board] where parentid="&yxbbs.boardid)(0)=0 then
yxbbs.execute("delete from[yx_board] where parentid=0 and boardid="&yxbbs.boardid)
call suc("","成功的删除了分类!","?")
end if
end sub
sub addboard
if yxbbs.execute("select boardid from [yx_board] where depth=0").eof then
call goback("","没有分类不能添加论坛!请先<a href=board.asp?action=addclass> ·添加分类</a>")
exit sub
end if%>
<form method=post style="margin:0" action="?action=saveboard">
<div class="ta">
<div class="th jz">论坛添加</div>
<div class="td1 h40">论坛名称:</div>
<div class="td2 h40"><input type=text name="boardname" size=30></div>
<div class="td1 h40">标志图片:<br />论坛版面logo地址,可以不填</div>
<div class="td2 h40"><input type=text name="boardimg" size=30></div>
<div class="td1 h40">论坛版主:<br />添加多版主请用@@分隔,如:name@@name</div>
<div class="td2 h40"><input type=text name="boardadmin" size=30></div>
<div class="td1 h70">论坛介绍:</div>
<div class="td2 h70 w446"><textarea rows="3" name="introduce"></textarea></div>
<div class="td1 h40">属于分类或论坛:</div>
<div class="td2 h40"><select size="1" name="parentid"><%=yxbbs.boardidlist(yxbbs.boardid,20)%></select></div>
<div class="td1 h40">限制用户等级:</div>
<div class="td2 h40"><select size="1" name="boardgrade">
<option value="0" selected>0级:游客</option>
<%
dim ug
set ug=conn.execute("select gradenum,gradename from yx_usergrade order by gradenum asc")
while not ug.eof
response.write "<option value="&ug(0)&">"&ug(0)&"级:"&ug(1)&"</option>"
ug.movenext
wend
set ug=nothing
%>
</select></div>
<div class="td1 h40">是否认证版面:<br />认证版只有版主和人证会员</div>
<div class="td2 h40"><input type="radio" value="1" name="boardtype">是 <input name="boardtype" type="radio" value="0" checked="true">否</div>
<div class="td1 h40">锁定版面:<br /> 锁定之后不可以发布帖子</div>
<div class="td2 h40"><input type="radio" value="1" name="boardlock">是 <input name="boardlock" type="radio" value="0" checked="true">否</div>
<div style="clear: both;"></div><div class="tf jz"><input type="submit" value=" 提 交 "> <input type="reset" value=" 重 置 "></div>
</div></form>
<%
end sub
sub saveboard
dim boardname,introduce,boardadmin,boardimg,boardgrade,boardlock,boardtype,parentid,newboardid,rootid,depth,child,orders,parentstr,i
boardname=yxbbs.fun.getstr("boardname")
introduce=yxbbs.fun.getstr("introduce")
boardadmin=yxbbs.fun.getstr("boardadmin")
boardgrade=yxbbs.fun.getstr("boardgrade")
boardlock=yxbbs.fun.getstr("boardlock")
boardtype=yxbbs.fun.getstr("boardtype")
boardimg=yxbbs.fun.getstr("boardimg")
parentid=yxbbs.fun.getstr("parentid")
if not isnumeric(parentid) or boardname="" or introduce="" then
call goback("",""):exit sub
end if
set rs=yxbbs.execute("select max(boardid) from [yx_board]")
if rs.eof or rs.bof then
call goback("","没有分类不能添加论坛!请先<a href=board.asp?action=addclass> ·添加分类</a>")
exit sub
else
newboardid=rs(0)+1
end if
rs.close
set rs=yxbbs.execute("select rootid,depth,child,orders,parentstr,parentid from[yx_board] where boardid="&parentid&"")
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)
parentstr=rs(4)
rs.close
if depth+1>maxdepth then
call goback("","考虑到论坛的实用易用,本论坛限制了最多只能有" & maxdepth & "级论坛!")
exit sub
end if
if parentstr=0 then
parentstr=parentid
else
parentstr=parentstr & "," & parentid
end if
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)")
if boardadmin <> "" then call addmaster(boardadmin,"none",0)
if parentid<>0 then
if depth>0 then
'当上级分类深度大于0的时候要更新其父类(或父类的父类)的版面数和相关排序
for i=1 to depth
'更新其父类版面数
yxbbs.execute("update [yx_board] set child=child+1 where boardid="&parentid)
'得到其父类的父类的版面id
set rs=yxbbs.execute("select parentid from [yx_board] where boardid="&parentid)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -