<% option explicit %> <% if session("purview")<>"99999" then response.write "错误!!您没有权限或者连接超时,请重新登陆." %> 登陆 <% response.end end if dim isedit '是否在修改状态 dim color '表格颜色 dim sql,rs,rsc dim writer '录入员 writer="" color=1 isedit=false if request("action")="edit" then isedit=true end if if request("action")="modify" then '**************************修改版面********************* if trim(request("typename"))="" then response.write "错误!版面名称不能为空! 返回" response.end end if set rs=server.createobject("adodb.recordset") '检查版面是否重名 rs.open "select * from type where typename='" & trim(request("typename")) & "'",conn,1,1 if err.number <> 0 then response.write "数据库出错" else if not rs.bof and not rs.eof then response.write "错误!该版面已存在! 返回" response.end end if end if rs.close set rs=nothing sql="update type set typename='" & cstr(trim(request("typename"))) & "' where typeid=" & cstr(request("typeid")) conn.execute sql if err.number <> 0 then response.write "数据库操作出错:" + err.description else %> <%end if end if if request("action")="add" then '******************************添加新版面************************ if trim(request("typename"))="" then response.write "错误!版面名称不能为空! 返回" response.end end if set rs=server.createobject("adodb.recordset") '检查版面是否重名 rs.open "select * from type where typename='" & trim(request("typename")) & "'",conn,1,1 if err.number <> 0 then response.write "数据库出错" else if not rs.bof and not rs.eof then response.write "错误!该版面已存在! 返回" response.end end if end if rs.close set rs=nothing sql="insert into type(typename) values('" & trim(request("typename")) & "')" conn.execute sql if err.number <> 0 then response.write "数据库操作出错:" + err.description else set rs=server.createobject("adodb.recordset") '在新版面自动插入"无专栏文章" 专栏 rs.open "select * from type where typename='" & trim(request("typename")) & "'",conn,1,1 if not rs.bof and not rs.eof then sql="insert into border(typeid,bordername) values(" & rs("typeid") & ",'无专栏文章')" conn.execute sql end if rs.close set rs=nothing %> <%end if end if if request("action")="del" then '**********************删除版面********************** sql="delete from type where typeid=" & cstr(request("typeid")) conn.execute sql if err.number <> 0 then response.write "数据库操作错误:" + err.description err.clear else sql="delete from border where typeid=" & cstr(request("typeid")) '删除与该版相关的专栏 conn.execute sql sql="delete from users where purview=" & cstr(request("typeid")) '删除该版的录入员 conn.execute sql sql="delete from news where typeid=" & cstr(request("typeid")) '删除该版面下的全部新闻 conn.execute sql %> <% end if end if %> 版面管理 <% set rs=server.createobject("adodb.recordset") rs.open "select * from type",conn,1,1 if err.number <> 0 then response.write "数据库出错" else if rs.bof and rs.eof then rs.close response.write "目前没有任何版面" else %> <% do while not rs.eof %> <% rs.movenext color=color+1 loop end if end if 'rs.close set rs=nothing %>
-----版 面 名 称-----
-----录 入 员-----
操作
">
<%=rs("typename")%>
"> <% set rsc=server.createobject("adodb.recordset") rsc.open "select * from users where purview=" & cstr(rs("typeid")),conn,1,1 if err.number <> 0 then response.write "数据库出错" else if rsc.bof and rsc.eof then rsc.close writer="目前无录入员" else writer="" do while not rsc.eof writer=""& rsc("name") & "|" & writer rsc.movenext loop writer="|" & writer end if end if ' rsc.close set rsc=nothing %>
<%=writer%>
">
删除

<% if isedit then set rs=server.createobject("adodb.recordset") rs.open "select * from type where typeid=" & cstr(request("typeid")),conn,1,1 response.write "编 辑 版 面
" else response.write "添 加 新 版 面
" end if %>

<%If isedit then%> <%End If%> 版面名称: