📄 typemanage.asp
字号:
<% option explicit %>
<!--#include file="../function1/DBOpen.asp"-->
<%
if session("purview")<>"99999" then
response.write "错误!!您没有权限或者连接超时,请重新登陆." %>
<a href="../login.asp" target="_top">登陆</a>
<% 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 "错误!版面名称不能为空! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
set rs=server.createobject("adodb.recordset") '检查版面是否重名
rs.open "select * from type where typename='" & trim(request("typename")) & "' and typeid<>" & cstr(request("typeid")),conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else if not rs.bof and not rs.eof then
response.write "错误!该版面已存在! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
end if
rs.close
set rs=nothing
sql="update type set typename='" & cstr(trim(request("typename"))) & "',typeorder=" & cstr(request("typeorder")) & " ,typeview=" & cstr(request("typeview")) & " ,del=" & cstr(request("del")) & " where typeid=" & cstr(request("typeid"))
conn.execute sql
if err.number <> 0 then
response.write "数据库操作出错:" + err.description
else %>
<script language=vbscript>
msgbox "操作成功!版面 <%=trim(request("typename"))%> 的信息已经更新!"
</script>
<%end if
end if
if request("action")="add" then '******************************添加新版面************************
if trim(request("typename"))="" then
response.write "错误!版面名称不能为空! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
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 "错误!该版面已存在! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
end if
rs.close
set rs=nothing
sql="insert into type(typename,typeorder,typeview,del) values('" & trim(request("typename")) & "','" & trim(request("typeorder")) & "','" & trim(request("typeview")) & "','" & trim(request("del")) & "' )"
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 %>
<script language=vbscript>
msgbox "操作成功!新版面 <%=trim(request("typename"))%> 的信息添加成功!"
</script>
<%end if
end if
if request("action")="del" then '**********************删除版面**********************
sql="delete from type where del<>1 and typeid=" & cstr(request("typeid"))
conn.execute sql
if err.number <> 0 then
response.write "数据库操作错误:" + err.description
err.clear
else
sql="delete from border where del<>1 and 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
%>
<script language=vbscript>
msgbox "操作成功!该版面的所有相关信息已删除!"
</script>
<% end if
end if
%><html>
<head>
<title>大类管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<div align="center">
<STYLE>TABLE {FONT-SIZE: 12px;COLOR: #000000; FONT-FAMILY: 宋体;LINE-HEIGHT: 180%}
.Shadow_white {FONT-SIZE: 14pt; FILTER: dropshadow(color:black, offx=1, offy=1, positive=1); WIDTH: 70%; COLOR: #000000; FONT-FAMILY: 宋体; POSITION: relative}
.Shadow_white2 {FONT-SIZE: 10pt; FILTER: dropshadow(color:black, offx=1, offy=1, positive=1); WIDTH: 70%; COLOR: #000000; FONT-FAMILY: 宋体; POSITION: relative}
A:link {COLOR: #000000; TEXT-DECORATION: none}
A:active {COLOR: #000000; TEXT-DECORATION: none}
A:visited {COLOR: #000000; TEXT-DECORATION: none}
A:hover {COLOR: #ff0000; TEXT-DECORATION: underline}
</STYLE></head>
<body>
<script language=javascript>
function SureDel(id)
{
if ( confirm("警告!如果您删除了该版面,版面下的专栏、文章、用户都将被删除!!是否继续?"))
{
window.location.href = "typemanage.asp?action=del&typeid=" + id
}
}
</script>
<%
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 %>
<table border="0" width="70%" bgcolor="#000000" cellpadding="0" cellspacing="1" align="center">
<tr bgcolor="#abb8d6">
<td colspan="3" height="50">
<div align="center"></div>
<div align="center"></div>
<div align="center"><b>系统大类管理</b></div>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="44%">
<div align="center">-----大 类名 称-----</div>
</td>
<td width="45%">
<div align="center">-----录 入 员-----</div>
</td>
<td width="11%">
<div align="center">操作</div>
</td>
</tr>
<% do while not rs.eof %>
<tr>
<td width="44%" bgcolor="<% if color mod 2=0 then
response.write "#ffffff"
else
response.write "#ffffff"
end if %>">
<div align="center"><a href='typemanage.asp?typeid=<%=cstr(rs("typeid"))%>&action=edit'><%=rs("typename")%></a></div>
</td>
<td width="45%" bgcolor="<% if color mod 2=0 then
response.write "#ffffff"
else
response.write "#ffffff"
end if %>">
<% 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="<font color=#990099>目前无录入员</font>"
else
writer=""
do while not rsc.eof
writer="<b>"& rsc("name") & "</b>|" & writer
rsc.movenext
loop
writer="|" & writer
end if
end if
' rsc.close
set rsc=nothing
%>
<div align="center"><%=writer%></div>
</td>
<td width="11%" bgcolor="<% if color mod 2=0 then
response.write "#ffffff"
else
response.write "#ffffff"
end if %>">
<div align="center"><a href='javascript:SureDel(<%=cstr(rs("typeid"))%>)'>删除</a></div>
</td>
</tr>
<% rs.movenext
color=color+1
loop
end if
end if
'rs.close
set rs=nothing
%>
</table>
<table width="70%" border="0" cellspacing="0" cellpadding="0" bgcolor="#abb8d6" style="border: 1px solid #000000">
<tr>
<td height="100">
<form action="typemanage.asp" method="post">
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr valign="bottom">
<td width="0%"> </td>
<td height="49" colspan="3">
<div align="center">
<% if isedit then
set rs=server.createobject("adodb.recordset")
rs.open "select * from type where typeid=" & cstr(request("typeid")),conn,1,1
response.write "<b>编 辑 版 面</b><br>"
else
response.write "<b>添 加 新 版 面</b><br>"
end if %>
<hr>
</div></td>
</tr>
<tr>
<td> </td>
<td width="0%"> <div align="left"> <br>
<br>
<br>
<br>
</div></td>
<td width="43%" align="right" valign="top">
<input type="Hidden" name="action" value='<% If isedit then%>modify<% Else %>add<% End If %>'>
<%If isedit then%>
<input type="Hidden" name="typeid" value='<%=cstr(request("typeid"))%>'>
<%End If%>
大类名称:<br>
显示序号:<br>
是否显示在菜单栏(1显示,0不显示):<br>
是否可删除(1不可删除,0可删除): </td>
<td width="57%" align="left" valign="top"> <input type="text" name="typename" class=input maxlength=40 size="20" value='<% if isedit then
response.write trim(rs("typename"))
end if %>'> <br>
<input type="text" name="typeorder" class=input maxlength=2 size="20" value='<% if isedit then
response.write trim(rs("typeorder"))
end if %>'> <br>
<input type="text" name="typeview" class=input maxlength=2 size="20" value='<% if isedit then
response.write trim(rs("typeview"))
end if %>'> <br>
<input name="del" type="text" class=input id="del2" value='<% if isedit then
response.write trim(rs("del"))
end if %>' size="20" maxlength=2>
<input type=submit value="确 定" class=button name="submit"> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
<p align="center"> </p>
</body>
</html>
<!--#include file="../function/DBclose.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -