📄 news1.asp
字号:
<!--#include file="../include/buyok_shop_30_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%call checkmanage("07")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function CheckAll(form) {
for (var i=0;i<form.elements.length;i++) {
var e = form.elements[i];
if (e.name != 'chkall') e.checked = form.chkall.checked;
}
}
</script>
</head>
<BODY background="../images/admin/back.gif">
<%
Set rs = conn.Execute("select * from shopsetup")
newstitle1=rs("newstitle1")
newstitle2=rs("newstitle2")
newstitle3=rs("newstitle3")
newstitle4=rs("newstitle4")
newstitle5=rs("newstitle5")
rs.close
set rs=nothing
nclass=trim(request("nclass"))
if nclass<>"" and nclass<>"1" and nclass<>"2" and nclass<>"3" and nclass<>"4" and nclass<>"5" then
response.write "<script language='javascript'>"
response.write "alert('没有相关新闻,单击“确定”返回上一页!');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if
action=request("action")
if action="" then
%>
<table width="98%" border="1" cellpadding="3" bordercolor="#333333" style="border-collapse: collapse;" style="word-break:break-all">
<form action=news1.asp method=post name="newslist">
<tr class=backs><td colspan=5 class=td height=18>新闻文章管理</td></tr>
<tr bgcolor="#003366" align=center><td width=5%>选</td> <td width=50%>标题(单击标题编辑新闻)</td><td width=15%>类别</td><td width=15%>发布时间</td><td width=15%>状态</td></tr>
<%
dim rs,msg_per_page
dim sql
msg_per_page = 20 '定义每页显示记录条数
sql = "select * from News"
if nclass<>"" then sql = sql + " where NewsClass='" & nclass &"'"
sql=sql+" order by uup desc, PubDate desc"
set rs=Server.CreateObject("ADODB.RecordSet")
rs.cursorlocation = 3 '使用客户端游标,可以使效率提高
rs.pagesize = msg_per_page '定义分页记录集每页显示记录数
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<tr><td height=18 class=b colspan=5 align=center>暂时没有新闻文章</td></tr>"
end if
if err.number<>0 then '错误处理
response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then '检测记录集是否为空
totalrec = RS.RecordCount 'totalrec:总记录条数
if rs.recordcount mod msg_per_page = 0 then '计算总页数,recordcount:数据的总记录数
n = rs.recordcount\msg_per_page 'n:总页数
else
n = rs.recordcount\msg_per_page+1
end if
currentpage = request("page") 'currentpage:当前页
If currentpage <> "" then
currentpage = clng(currentpage)
if currentpage < 1 then
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then
currentPage=1
end if
rs.absolutepage = currentpage 'absolutepage:设置指针指向某页开头
rowcount = rs.pagesize 'pagesize:设置每一页的数据记录数
dim i
dim k
%>
<%
do while not rs.eof and rowcount>0
%>
<tr><td height=18 class=b><input type='checkbox' value='<%=Cstr(rs("NewsId"))%>' name=id></td><td><a href="news1.asp?action=modify&id=<%=Cstr(rs("NewsId"))%>" title='编辑这篇新闻文章' ><%=rs("NewsTitle")%></a></td>
<td>
<%
if rs("NewsClass")="1" then
response.write newstitle1
elseif rs("NewsClass")="2" then
response.write newstitle2
elseif rs("NewsClass")="3" then
response.write newstitle3
elseif rs("NewsClass")="4" then
response.write newstitle4
elseif rs("NewsClass")="5" then
response.write newstitle5
end if
%>
</td><td><%=split(rs("PubDate")," ")(0)%>
</td><td> <% if rs("Online")=true then response.write "显示 " else response.write "<font color=red><b>隐藏</b></font>" end if%><% if rs("uup")=1 then response.write " 固顶" end if%></td></tr>
<%
rowcount=rowcount-1
rs.movenext
loop
end if
end if
rs.close
conn.close
set rs=nothing
set coon=nothing
%>
<tr><td colspan=5 class=b>
<input type='checkbox' name=chkall onclick='CheckAll(this.form)'>全选
<input type="submit" name="action" value="关闭" onclick="{if(confirm('确定隐藏这条新闻吗?')){this.document.newslist.submit();return true;}return false;}"> <input type="submit" name="action" value="打开" onclick="{if(confirm('确定要显示这条新闻吗?')){this.document.newslist.submit();return true;}return false;}">
<input type="submit" name="action" value="删除" onclick="{if(confirm('该操作不可恢复!\n\n确定删除选定的新闻?')){this.document.newslist.submit();return true;}return false;}">
<input type="button" name="action" onclick="javascript:location.href='news1.asp?action=addnews';" value="添加新闻">
</td></tr>
</form></table>
<%call listPages()%>
<%end if
if action="关闭" then
NewsId=replace(request("id")," ","")
call prodclose()
end if
if action="打开" then
NewsId=replace(request("id")," ","")
call prodopen()
end if
if action="删除" then
delid=replace(request("id")," ","")
call proddel()
end if
if action="addnews" then
call newsadd()
end if
if action="modify" then
id=request("id")
call modify()
end if%>
</table><br><br></td></tr>
</table>
</body>
</html>
<%
sub listPages()
if n <= 1 then exit sub
%>
<p>>>
<%if currentpage = 1 then%>
<font color=darkgray>首页</font>
<%else%>
<font color=black face="arial"><a href="<%=request.ServerVariables("script_name")%>?page=1">
首页</font></a>
<a href="<%=request.ServerVariables("script_name")%>?page=<%=currentpage-1%>">
<font color=black face="arial" >前页</a></font>
<%end if%>
<%if currentpage = n then%>
<font color=darkgray face="arial" >后页</font>
<%else%>
<font color=black face="arial" ><a href="<%=request.ServerVariables("script_name")%>?page=<%=currentpage+1%>">下页</a>
<a href="<%=request.ServerVariables("script_name")%>?page=<%=n%>">末页</a></font>
<%end if%>
<font color=black face="arial" >
总:<%=currentpage%>/<%=n%>页 <%=msg_per_page%>新闻/页 共:<%=totalrec%>新闻</font></p>
<%end sub
sub prodopen()
if NewsId="" or isnull(NewsId) then
response.write "<script language='javascript'>"
response.write "alert('操作失败,您什么也没有选择。');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
else
Set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from News where NewsId in ("&NewsId&")"
rs.open sql,conn,1,3
if err.number<>0 then '错误处理
response.write "数据库操作失败:" & err.description
err.clear
else
if rs.eof and rs.bof then
response.write "<script language='javascript'>"
response.write "alert('该新闻不存在,或者被删除了!');"
response.write "location.href='news1.asp';"
response.write "</script>"
else
Do while not rs.eof
rs("online")=true
rs.update
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -