📄 admin_forum.asp
字号:
<!-- #include file="include/onlogin.asp" -->
<!-- #include file="include/conn.asp" -->
<%
dim admin_menu
admin_menu="<a href='?'>论坛管理</a> ┋ " & _
"<a href='?action=mod'>合并论坛</a> ┋ " & _
"<a href='?action=order'>重新排序</a>"
response.write header(11,admin_menu)
select case action
case "mod"
call forum_mod()
case "order"
call forum_order()
call forum_main()
case "orderc"
call forum_orderc()
call forum_main()
case "orders"
call forum_orders()
call forum_main()
case "forum_add"
call forum_add()
case "forum_edit"
call forum_edit()
case "del_forum"
call del_forum()
case "class_add"
call class_add()
case "class_edit"
call class_edit()
case "del_class"
call del_class()
case else
call forum_main()
end select
call close_conn()
response.write ender()
sub forum_order_board(cid,fid,ff)
dim rsboard,strsqlboard,forumid,fff,fj
fff=ff:fj=1
strsqlboard="select forum_id from bbs_forum where forum_f="&fid&" and class_id=" & cid & " order by forum_order"
set rsboard=conn.execute(strsqlboard)
if rsboard.eof and rsboard.bof then
rsboard.close:set rsboard=nothing
exit sub
end if
do while not rsboard.eof
forumid=rsboard("forum_id")
conn.execute("update bbs_forum set forum_order="&fj&" where forum_id="&forumid)
call forum_order_board(cid,forumid,ff+1)
rsboard.movenext
fj=fj+1
loop
conn.execute("update bbs_forum set forum_n="&fj-1&" where forum_id="&fid)
rsboard.close:set rsboard=nothing
end sub
sub forum_order()
dim rs,sql,i,cid:i=1
conn.execute("update bbs_forum set forum_n=0")
sql="select class_id from bbs_class order by class_order,class_id"
set rs=conn.execute(sql)
do while not rs.eof
cid=rs(0)
conn.execute("update bbs_class set class_order="&i&" where class_id="&cid)
call forum_order_board(cid,0,0)
rs.movenext
i=i+1
loop
rs.close:set rs=nothing
end sub
sub forum_orders()
dim fid,classid,forumid,actions,tmp_id_1,tmp_id_2,tmp_order_1,tmp_order_2,sqladd,update_ok,rssum
classid=trim(request.querystring("class_id"))
forumid=trim(request.querystring("forum_id"))
fid=trim(request.querystring("fid"))
actions=trim(request.querystring("actions"))
if not(isnumeric(fid)) or not(isnumeric(classid)) or not(isnumeric(forumid)) or (actions<>"up" and actions<>"down") then exit sub
update_ok="no":sqladd=""
if actions="up" then sqladd=" desc"
sql="select forum_order from bbs_forum where forum_id="&forumid&" and class_id="&classid
set rs=conn.execute(sql)
if rs.eof and rs.bof then rs.close:set rs=nothing:exit sub
rs.close:set rs=nothing
sql="select forum_id,forum_order from bbs_forum where forum_f="&fid&" and class_id="&classid&" order by forum_order"&sqladd&",forum_id desc"
set rs=conn.execute(sql)
do while not rs.eof
if int(rs("forum_id"))=int(forumid) then
tmp_id_1=forumid
tmp_order_1=rs("forum_order")
rs.movenext
if not rs.eof then
tmp_id_2=rs("forum_id")
tmp_order_2=rs("forum_order")
update_ok="yes"
exit do
end if
exit do
end if
rs.movenext
loop
rs.close:set rs=nothing
if update_ok="yes" then
sql="update bbs_forum set forum_order="&tmp_order_2&" where forum_id="&tmp_id_1
conn.execute(sql)
sql="update bbs_forum set forum_order="&tmp_order_1&" where forum_id="&tmp_id_2
conn.execute(sql)
end if
end sub
sub forum_orderc()
dim classid,actions
classid=trim(request.querystring("class_id"))
actions=trim(request.querystring("actions"))
if not(isnumeric(classid)) or (actions<>"up" and actions<>"down") then exit sub
dim tmp_id_1,tmp_id_2,tmp_order_1,tmp_order_2,sqladd,update_ok
update_ok="no":sqladd=""
if actions="up" then sqladd=" desc"
sql="select * from bbs_class where class_id="&classid
set rs=conn.execute(sql)
if rs.eof and rs.bof then rs.close:set rs=nothing:exit sub
rs.close:set rs=nothing
sql="select * from bbs_class order by class_order"&sqladd
set rs=conn.execute(sql)
do while not rs.eof
if int(rs("class_id"))=int(classid) then
tmp_id_1=classid
tmp_order_1=rs("class_order")
rs.movenext
if not rs.eof then
tmp_id_2=rs("class_id")
tmp_order_2=rs("class_order")
update_ok="yes"
exit do
end if
exit do
end if
rs.movenext
loop
rs.close:set rs=nothing
if update_ok="yes" then
sql="update bbs_class set class_order="&tmp_order_2&" where class_id="&tmp_id_1
conn.execute(sql)
sql="update bbs_class set class_order="&tmp_order_1&" where class_id="&tmp_id_2
conn.execute(sql)
end if
end sub
sub class_edit()
dim classid,rs,strsql,class_name,class_order
classid=trim(request("class_id"))
if not(isnumeric(classid)) then
response.redirect "admin_forum.asp"
response.end
end if
set rs=server.createobject("adodb.recordset")
strsql="Select * from bbs_class where class_id="&classid
rs.open strsql,conn,1,3
%><font class=red>修改论坛分类</font><br><br><br>
<table border=0 width=300><%
if trim(request("edit"))="ok" then
class_name=code_form(request.form("class_name"))
if class_name="" then
response.write( VbCrLf & "<tr><td height=80 align=center><font class=red_2>论坛分类名称不能为空!</font><br><br>"&go_back&"</td></tr>")
else
rs("class_name")=class_name
rs.update
response.write( VbCrLf & "<tr><td height=80 align=center>成功的修改了论坛分类:<font class=red>" & class_name & "</font></td></tr>")
end if
else
%>
<tr>
<form method=post action='admin_forum.asp?action=class_edit&class_id=<%=classid%>&edit=ok'>
<td width='40%' align=center></td><td width='60%'></td>
</tr>
<tr height=30>
<td align=center>论坛分类名称:</td>
<td><input type=text name=class_name value='<%=rs("class_name")%>' size=20 maxlength=20></td>
</tr>
<tr height=30>
<td colspan=2 align=center height=30><input type=submit value=' 提 交 修 改 '></td>
</form>
</tr><%
end if
rs.close:set rs=nothing
%></table><%
end sub
sub class_add()
%><font class=red>添加论坛分类</font><br><br><br>
<table border=0 width=300>
<%
if trim(request.querystring("add"))="ok" then
dim rs,strsql,class_name,class_order
class_name=code_form(request.form("class_name"))
if class_name="" then
response.write( VbCrLf & "<tr><td height=80 align=center><font class=red_2>论坛分类名称不能为空!</font><br><br>"&go_back&"</td></tr>")
else
set rs=server.createobject("adodb.recordset")
strsql="Select top 1 * from bbs_class order by class_order desc"
rs.open strsql,conn,1,1
if rs.eof and rs.bof then
class_order=0
else
class_order=rs("class_order")
end if
class_order=class_order+1
rs.close
strsql="Select * from bbs_class"
rs.open strsql,conn,1,3
rs.addnew
rs("class_order")=class_order
rs("class_name")=class_name
rs.update
response.write( VbCrLf & "<tr><td height=80 align=center>成功的添加了论坛分类:<font class=red>" & class_name & "</font></td></tr>")
rs.close:set rs=nothing
end if
else
%>
<tr>
<form method=post action='admin_forum.asp?action=class_add&add=ok'>
<td width='40%' align=center></td><td width='60%'></td>
</tr>
<tr height=30>
<td align=center>论坛分类名称:</td>
<td><input type=text name=class_name size=20 maxlength=20></td>
</tr>
<tr height=30>
<td colspan=2 align=center height=30><input type=submit value=' 提 交 添 加 '></td>
</form>
</tr><%
end if
%></table><%
end sub
sub forum_edit()
dim classid,classid2,forumid,forumid2,formid,rs,strsql,classname,forum_name,forum_pro
classid=trim(request.querystring("class_id"))
forumid=trim(request.querystring("forum_id"))
if not(isnumeric(classid)) or not(isnumeric(forumid)) then call forum_main():exit sub
strsql="select class_name from bbs_class where class_id="&classid
set rs=conn.execute(strsql)
if rs.eof and rs.bof then rs.close:set rs=nothing:call forum_main():exit sub
classname=rs("class_name")
rs.close:set rs=nothing
%><font class=red>修改论坛</font>(<font class=blue_1><%=classname%></font>)<br><br><br>
<table border=0 width=400><%
set rs=server.createobject("adodb.recordset")
strsql="Select * from bbs_forum where forum_id="&forumid
rs.open strsql,conn,1,3
if trim(request.querystring("edit"))="ok" then
formid=trim(request.form("formid"))
forum_pro=trim(request.form("forum_pro"))
if not(isnumeric(forum_pro)) then forum_pro=0
if int(forum_pro)<>1 and int(forum_pro)<>2 then forum_pro=0
if len(formid)<3 or instr(1,formid,"-")<=0 then call forum_main():exit sub
classid2=left(formid,instr(1,formid,"-")-1)
forumid2=right(formid,len(formid)-instr(1,formid,"-"))
forum_name=code_admin(request.form("forum_name"))
if forum_name="" then
response.write( VbCrLf & "<tr><td height=80 align=center><font class=red_2>论坛名称不能为空!</font><br><br>"&go_back&"</td></tr>")
else
if int(classid2)<>int(classid) then rs("class_id")=classid2
if int(forumid2)<>int(forumid) then rs("forum_f")=forumid2
if request.form("forum_w")="yes" then
rs("forum_w")=true
else
rs("forum_w")=false
end if
rs("forum_name")=forum_name
rs("forum_pic")=trim(request.form("forum_pic"))
if request.form("forum_hidden")="no" then
rs("forum_hidden")=false
else
rs("forum_hidden")=true
end if
rs("forum_pro")=forum_pro
rs("forum_type")=request.form("forum_type")
rs("forum_remark")=request.form("forum_remark")
rs("forum_power")=code_form(request.form("forum_power"))
rs.update
response.write( VbCrLf & "<tr><td height=80 align=center>成功的修改了论坛:<font class=red>" & forum_name & "</font></td></tr>")
end if
else
%><form method=post action='admin_forum.asp?action=forum_edit&class_id=<%=classid%>&forum_id=<%=forumid%>&edit=ok'>
<tr><td width='20%' align=center></td><td width='80%'></td></tr>
<tr height=30><td align=center>论坛名称:</td><td><input type=text name=forum_name value='<%=rs("forum_name")%>' size=30 maxlength=20></td></tr>
<tr height=30><td align=center>所属分类:</td><td><select name=formid size=1><%
dim crs,csql,cid,ctype
csql="select * from bbs_class order by class_order"
set crs=conn.execute(csql)
do while not crs.eof
cid=crs("class_id")
response.write vbcrlf & "<option value='"&cid&"-0'"
if int(classid)=int(cid) then
response.write " selected class=bg_1"
end if
response.write ">╋"&crs("class_name")&"</option>"
call forum_edit_board(cid,0,0,forumid)
crs.movenext
loop
ctype=int(rs("forum_type"))
%></select></td></tr>
<tr><td align=center>论坛说明:</td><td><textarea name=forum_remark rows=5 cols=50><%=rs("forum_remark")%></textarea></td></tr>
<tr><td align=center>论坛类型:</td><td><select name=forum_type size=1><%
dim tdim,t2
tdim=split(forum_type,"|")
for i=0 to ubound(tdim)
response.write vbcrlf&"<option value='"&i+1&"'"
if ctype=i+1 then response.write " selected"
response.write ">"&right(tdim(i),len(tdim(i))-instr(tdim(i),":"))&"</option>"
next
erase tdim
forum_pro=rs("forum_pro")
if not(isnumeric(forum_pro)) then forum_pro=0
forum_pro=int(forum_pro)
%></select> 是否开放:<input type=checkbox name=forum_hidden value='no'<% if rs("forum_hidden")=false then response.write " checked" %>> (选上为开放)</td></tr>
<tr><td align=center>论坛属性:</td><td><input type=radio name=forum_pro value='0'<%if forum_pro<>1 then response.write " checked"%>>正常 <input type=radio name=forum_pro value='1'<%if forum_pro=1 then response.write " checked"%>>只读</td></tr>
<tr><td align=center>发贴模式:</td><td><input type=checkbox name=forum_w value='yes'<% if rs("forum_w")=true then response.write " checked" %>> (选上为可以发表新的主题)</td></tr>
<tr><td align=center>论坛图片:</td><td><input type=text name=forum_pic value='<%=rs("forum_pic")%>' size=30 maxlength=50> 例:<a title='代表 images/forum/sample.gif 这个图片<br>也可以直接填写图片的URL地址'>$sample.gif</a></td></tr>
<tr height=50><td align=center>论坛版主:<br><br></td><td><input type=text name=forum_power value='<%=rs("forum_power")%>' size=50 maxlength=50><br>多个请用“|”分开,如:“joekoe|apple|5271”</td></tr>
<tr height=30><td colspan=2 align=center height=30><input type=submit value=' 提 交 修 改 '></td></tr>
</form><%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -