📄 bordermanage.asp
字号:
<% option explicit %>
<!--#include file="../function1/DBOpen.asp"-->
<%
if session("purview")<>"99999" then
response.write "错误!!您没有权限或者连接超时,请重新登陆." %>
<body bgcolor="#FFFFFF">
<a href="../login.asp" target="_top">登陆</a>
<% response.end
end if
dim isedit '是否在修改状态
dim color '表格颜色
dim sql,rs,rsc
dim border
border=""
color=1
isedit=false
if request("action")="edit" then
isedit=true
end if
if request("action")="modify" then '**************************修改专栏*********************
if trim(request("bordername"))="" then
response.write "错误!专栏名称不能为空! <a href='bordermanage.asp'>返回</a>"
response.end
end if
set rs=server.createobject("adodb.recordset") '检查专栏是否重名
rs.open "select * from border where bordername='" & trim(request("bordername")) & "' and typeid=" & cstr(request("typeid")) &" and borderid<>" & cstr(request("borderid")),conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else if not rs.bof and not rs.eof then
response.write "错误!该专栏已存在! <a href='bordermanage.asp'>返回</a>"
response.end
end if
end if
rs.close
set rs=nothing
sql="update border set bordername='" & cstr(trim(request("bordername"))) & "',typeid=" & cstr(request("typeid")) & " ,borderorder=" & cstr(request("borderorder")) & " ,borderview=" & cstr(request("borderview")) & ",del=" & cstr(request("del")) & " where borderid=" & cstr(request("borderid"))
conn.execute sql
if err.number <> 0 then
response.write "数据库操作出错:" + err.description
else %>
<script language=vbscript>
msgbox "操作成功!专栏 <%=trim(request("bordername"))%> 的信息已经更新!"
</script>
<%end if
end if
if request("action")="add" then '******************************添加新专栏************************
if trim(request("bordername"))="" or request("typeid")="" 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 border where bordername='" & trim(request("bordername")) & "' 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='bordermanage.asp'>返回</a>"
response.end
end if
end if
rs.close
set rs=nothing
sql="insert into border(bordername,typeid,borderorder,borderview,del) values('" & trim(request("bordername")) & "'," & cstr(request("typeid")) & ",'" & trim(request("borderorder")) & "','" & trim(request("borderview")) & "','" & trim(request("del")) & "')"
conn.execute sql
if err.number <> 0 then
response.write "数据库操作出错:" + err.description
else %>
<script language=vbscript>
msgbox "操作成功!新专栏 <%=trim(request("bordername"))%> 的信息添加成功!"
</script>
<%end if
end if
if request("action")="del" then '**********************删除专栏**********************
sql="delete from border where borderid=" & cstr(request("borderid"))
conn.execute sql
if err.number <> 0 then
response.write "数据库操作错误:" + err.description
err.clear
else
sql="delete from news where borderid=" & cstr(request("borderid")) '删除该专栏下的全部新闻
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">
<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>
<script language=javascript>
function SureDel(id)
{
if ( confirm("警告!如果您删除了该专栏,专栏下的文章都将被删除!!是否继续?"))
{
window.location.href = "bordermanage.asp?action=del&borderid=" + id
}
}
</script>
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from border where bordername<>'无专栏文章' order by typeid ",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="87%" 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="46%" height="15">
<div align="center">-----小 类 名 称-----</div>
</td>
<td width="40%">
<div align="center">-----所 属 大 类-----</div>
</td>
<td width="14%" height="15">
<div align="center">操作</div>
</td>
</tr>
<% do while not rs.eof %>
<tr>
<td width="46%" bgcolor="<% if color mod 2=0 then
response.write "#ffffff"
else
response.write "#efefef"
end if %>">
<div align="center"><a href='bordermanage.asp?borderid=<%=cstr(rs("borderid"))%>&action=edit'><%=rs("bordername")%></a></div>
</td>
<td width="40%" bgcolor="<% if color mod 2=0 then
response.write "#ffffff"
else
response.write "#efefef"
end if %>">
<% set rsc=server.createobject("adodb.recordset")
rsc.open "select * from type where typeid=" & cstr(rs("typeid")) ,conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else
if rsc.bof and rsc.eof then
border="<font color=#990099>无效专栏</font>"
else
border=rsc("typename")
end if
end if
rsc.close
set rsc=nothing
%>
<div align="center"><%=border%></div>
</td>
<td width="14%" bgcolor="<% if color mod 2=0 then
response.write "#ffffff"
else
response.write "#efefef"
end if %>">
<div align="center"><a href='javascript:SureDel(<%=cstr(rs("borderid"))%>)'>删除</a></div>
</td>
</tr>
<% rs.movenext
color=color+1
loop
end if
end if
'rs.close
set rs=nothing
%>
</table>
<div align="center">
<table width="87%" border="0" cellspacing="0" cellpadding="0" bgcolor="#abb8d6" style="border: 1px solid #000000">
<tr>
<td>
<form action="bordermanage.asp" method="post">
<br>
<table width="105%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="30" colspan="3"> <div align="center">
<% if isedit then
set rs=server.createobject("adodb.recordset")
rs.open "select * from border where borderid=" & cstr(request("borderid")),conn,1,1
response.write "<b>编 辑 小 类</b><br>"
else
response.write "<b>添 加 新 小 类</b><br>"
end if %>
<hr>
</div></td>
</tr>
<tr>
<td width="0%" align="right"> </td>
<td width="44%" 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="borderid" value='<%=cstr(request("borderid"))%>'>
<%End If%>
小栏名称:</td>
<td width="56%" align="left" valign="top"><input type="text" name="bordername" class=input maxlength=40 size="30" value='<% if isedit then
response.write trim(rs("bordername"))
end if %>'></td>
</tr>
<tr>
<td align="right"> </td>
<td align="right" valign="top">显示序号:</td>
<td align="left" valign="top"><input name="borderorder" type="text" class=input id="borderorder3" value='<% if isedit then
response.write trim(rs("borderorder"))
end if %>' size="30" maxlength=2>
</td>
</tr>
<tr>
<td align="right"> </td>
<td align="right" valign="top">是否显示在菜单栏(1显示,0不显示):</td>
<td align="left" valign="top"><input name="borderview" type="text" class=input id="borderview3" value='<% if isedit then
response.write trim(rs("borderview"))
end if %>' size="30" maxlength=2></td>
</tr>
<tr>
<td align="right"> </td>
<td align="right" valign="top">是否可删除(1不可删除,0可删除):</td>
<td align="left" valign="top"><input name="del" type="text" class=input id="del3" value='<% if isedit then
response.write trim(rs("del"))
end if %>' size="30" maxlength=2></td>
</tr>
<tr>
<td align="right"> </td>
<td align="right" valign="top">所属大类:</td>
<td align="left" valign="top"><select name="typeid" class=select>
<% set rsc=server.createobject("adodb.recordset")
rsc.open "select * from type order by typeid",conn,1,1
do while not rsc.eof
if isedit then %>
<option value='<%=rsc("typeid")%>' <% if trim(rs("typeid"))=trim(rsc("typeid")) then
response.write "selected"
end if %>><%=rsc("typename")%></option>
<% else %>
<option value='<%=rsc("typeid")%>'><%=rsc("typename")%></option>
<% end if
rsc.movenext
loop
rsc.close
set rsc=nothing %>
</select> <input type=submit value="确 定" class=button name="submit">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<br>
</div>
</body>
</html>
<!--#include file="../function/DBclose.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -