📄 news_admin.asp
字号:
<!--#include file="admin.asp"-->
<%
chk_admin_login(3)
sql="select * from [news] order by id desc"
rs.open sql,conn,1,1
pagesetup=20 '设定每页的显示数量
rs.pagesize=pagesetup
TotalPage=rs.pagecount '总页数
PageCount = cint(Request.QueryString("ToPage"))
if PageCount <1 then PageCount = 1
if PageCount > TotalPage then PageCount = TotalPage
if TotalPage>0 then rs.absolutepage=PageCount '跳转到指定页数
select case request("option")
case "del"
id=request("id")
chk_admin_login(3)
call del()
case "lock"
id=request("id")
chk_admin_login(3)
lock
case "unlock"
id=request("id")
unlock
end select
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/admin.css" rel="stylesheet" type="text/css">
<script language=javascript src="inc/select.js"></script>
</head>
<body>
<a href="news_add.asp">添加新闻</a>
<table width="99%" border="0" align="center" cellpadding="4" cellspacing="1" class="a2">
<form action="" method="post" onSubmit="return Confirm()">
<tr class="a1">
<td width="5%" height="25" align="center"> ID</td>
<td width="62%" height="25" align="center"> 新闻标题</td>
<td width="12%" align="center">新闻类型</td>
<td width="7%" align="center">状态</td>
<td width="5%" align="center">点击</td>
<td width="9%" align="center">操 作</td>
</tr>
<%
i=0
j=0
Do While Not RS.EOF and i<pagesetup
i=i+1
if j mod 2 = 0 then
a="a3"
else
a="a4"
end if
%>
<tr class="<%=a%>">
<td height="22" align="center"><INPUT name=id type=checkbox id="id" value=<%=rs("id")%>></td>
<td height="25"> <a href=../news_show.asp?Id=<%=rs("id")%> target="_blank"><font color="<%=rs("titlecolor")%>"><%=rs("title")%></font></a> [<%=rs("time")%>]</td>
<td align="center"><%
sql2="select * from [newstype] where id="&cint(rs("type"))
set rs2 = conn.Execute (sql2)
Response.Write rs2("typename")
%></td>
<td align="center"><%
if rs("display")=1 then
Response.Write("<font color=#cccccc>隐藏</font>")
else
Response.Write("正常")
end if%></td>
<td align="center"><%=rs("counter")%></td>
<td align="center"><a href="news_edit.asp?id=<%=rs("id")%>">修改</a></td>
</tr>
<%
j=j+1
rs.movenext
loop
rs.close
set rs=nothing
%>
<tr class="a4">
<td height="25" colspan="6" align="center"><input name=chkall type=checkbox id="chkall" onclick=CheckAll(this.form) value="ON">
全选
<input name="option" type="radio" value="lock">
隐藏
<input name="option" type="radio" value="unlock">
显示
<input type="radio" name="option" value="del">
删除
<input name="Submit" type="submit" id="Submit" value=" 确 定"> </td>
</tr>
</form>
</table>
[<b>共有
<font color="990000"><%=TotalPage%></font> 页
<script>
ShowPage(<%=TotalPage%>,<%=PageCount%>,"")
</script>
</b>]
</body>
</html>
<%
sub Del()
if ID="" then
Response.Write "<br><li>请指定要删除的用户</li>"
end if
if instr(ID,",")>0 then
ID=replace(ID," ","")
sql="delete from [news] where id in (" & ID & ")"
else
sql="delete from [news] where id=" & Clng(ID)
end if
Conn.Execute sql
response.redirect "news_admin.asp"
end sub
sub lock()
if ID="" then
Response.Write "<br><li>请指定要删除的用户</li>"
end if
if instr(ID,",")>0 then
ID=replace(ID," ","")
sql="update [news] set display=1 where id in (" & ID & ")"
else
sql="update [news] set display=1 where id=" & Clng(ID)
end if
Conn.Execute sql
response.redirect "news_admin.asp"
end sub
sub unlock()
if ID="" then
Response.Write "<br><li>请指定要删除的用户</li>"
end if
if instr(ID,",")>0 then
ID=replace(ID," ","")
sql="update [news] set display=0 where id in (" & ID & ")"
else
sql="update [news] set display=0 where id=" & Clng(ID)
end if
Conn.Execute sql
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -