📄 admin_announce.asp
字号:
<!--#include file="Include/Gaobei_setup.asp"-->
<!--#include file="Conn.asp"-->
<!--#include file="include/char.asp" -->
<!--#include file="Include/check.asp"-->
<!--#include FILE="Include/Admin_Function.asp"-->
<%CheckAdmin3%>
<% Set rs = Server.CreateObject("ADODB.Recordset") %>
<html>
<title>管理网站公告</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/JavaScript">
<!--
function doSubmit(){
if (document.Announce.Title.value==""){
alert("公告标题不能为空!");
return false;
}
if (document.Announce.Content.value==""){
alert("公告内容不能为空!");
return false;
}
return true;
}
//-->
</script>
<link href="other/Admin.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" align="center"><a href="Admin_Announce.asp?action=Add">添加公告</a> | <a href="Admin_Announce.asp">管理公告</a></td>
</tr>
</table>
<br>
<%if request("action")="Edit" then
id=request.querystring("id")
rs.Open "Select * From Announce where id="&id, conn,3,3
%>
<form action="Admin_Announce.asp?Action=Modify" method="POST" name="Announce" id="Announce" >
<table width="482" height="223" border="0" align="center" cellpadding="0" cellspacing="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
<tr bgcolor="#F6F6F6">
<td height="24" colspan=2 align=center>修 改 公 告</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="114" height="23">
<div align="center">标题:</div></td>
<td width="365" height="23"> <input type="text" name="Title" size="30" value="<%=rs("Title")%>">
<input type=hidden name=id value="<%=rs("id")%>">
<input name="taxis" type="text" id="Order" value="<%=Rs("taxis")%>" size="2" maxlength="5" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; COLOR: rgb(255,0,0); BORDER-BOTTOM: rgb(0,0,0) 1px solid" >
排序</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="147">
<div align="center">内容:</div></td>
<td> <textarea name="Content" rows="10" cols="50"><%=rs("Content")%></textarea>
</td>
</tr>
<tr bgcolor="#F6F6F6">
<td height="24" colspan=2 align=center>
<input type="submit" name="Submit" value="提交" onClick="return doSubmit()">
<input type="reset" name="reset" value="清除"></td>
</tr>
</table>
</form>
<% end if %>
<% if request("action")="Add" then %>
<form action="Admin_Announce.asp?Action=Save" method="post" name="Announce" id="Announce">
<table width="455" height="224" border="0" align="center" cellpadding="0" cellspacing="1" bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
<tr>
<td height="24" colspan=2 align=center bgcolor="#F6F6F6">添 加 公 告</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="114" height="23">
<div align="center">标题:</div></td>
<td width="365">
<input name="Title" type="text" id="Title" size="35">
<input type=hidden name=id value="<%=rs("id")%>">
<input name="Order" type="text" id="Order" value="<%=Rs("taxis")%>" size="2" maxlength="5" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; COLOR: rgb(255,0,0); BORDER-BOTTOM: rgb(0,0,0) 1px solid" >
排序</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="147">
<div align="center">内容:</div></td>
<td> <textarea name="Content" cols="50" rows="10" id="内容"></textarea>
</td>
</tr>
<tr bgcolor="#F6F6F6">
<td height="24" colspan=2 align=center>
<input type="submit" name="Add" value="添加" onClick="return doSubmit()">
<input type="reset" name="Reset" value="清除"></td>
</tr>
</table>
</form>
<% end if %>
<%
if request("action") = "" then
If Request.QueryString("CurPage") = "" or Request.QueryString("CurPage") = 0 then
CurPage = 1
Else
CurPage = CINT(Request.QueryString("CurPage"))
End If
rs.Open "Select * From Announce Order By id DESC", conn, 1,1
if rs.eof and rs.bof then
Response.Write("<p align='center'>暂时没有任何记录!</p>")
else
RS.PageSize=20 '设置每页记录数
Dim TotalPages
TotalPages = RS.PageCount
If CurPage>RS.Pagecount Then
CurPage=RS.Pagecount
end if
RS.AbsolutePage=CurPage
rs.CacheSize = RS.PageSize'设置最大记录数
Dim Totalcount
Totalcount =INT(RS.recordcount)
StartPageNum=1
do while StartPageNum+10<=CurPage
StartPageNum=StartPageNum+10
Loop
EndPageNum=StartPageNum+9
If EndPageNum>RS.Pagecount then EndPageNum=RS.Pagecount
%>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bordercolorlight="#999999" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
<tr>
<td width="258" height="20" bgcolor="#F6F6F6"><div align="center"> 公告标题</div></td>
<td width="128" height="20" align="center" bgcolor="#F6F6F6">时 间</td>
<td width="128" height="20" align="center" bgcolor="#F6F6F6">排 序</td>
<td width="110" height="23" align="center" bgcolor="#F6F6F6">操 作</td>
</tr>
<%
I=0
p=RS.PageSize*(Curpage-1)
do while (Not RS.Eof) and (I<RS.PageSize)
p=p+1
%>
<tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#F7F8F8'">
<td height="19" align=left bordercolorlight="#C0C0C0"> <img src="images/Gaobei_doc.gif"> <%=left(rs("Title"),18)%>...</td>
<td align="center"><%=rs("time")%></td>
<td align="center"><input name="Order" type="text" id="Order" value="<%=Rs("taxis")%>" size="2" maxlength="5" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; COLOR: rgb(255,0,0); BORDER-BOTTOM: rgb(0,0,0) 1px solid" ></td>
<td height="23" align=middle bordercolorlight="#c0c0c0" bgcolor="#FFFFFF"><div align="center"><a href="Admin_Announce.asp?Action=Edit&id=<%=rs("id")%>">修改</a>
| <a href="Announce_Modify.asp?id=<%=rs("id")%>"></a><a href="Admin_Announce.asp?Action=Del&id=<%=rs("id")%>">删除</a><a href="Announce_Modify.asp?id=<%=rs("id")%>"></a></div></td>
</tr>
<%
I=I+1
RS.MoveNext
Loop
%>
<tr bgcolor="#FFFFFF">
<td height="23" colspan=4 align="center" bordercolorlight="#C0C0C0">页次: <font color="#CC0000"><%=CurPage%></font>/<%=TotalPages%>
页数: <a href="Admin_Announce.asp?CurPage=<%=StartPageNum-1%>"><<</a>
<% For I=StartPageNum to EndPageNum
if I<>CurPage then %>
<a href="Admin_Announce.asp?CurPage=<%=I%>"><%=I%></a>
<% else %>
<%=I%>
<% end if %>
<% Next %>
<% if EndPageNum<RS.Pagecount then %>
<a href="Admin_Announce.asp?CurPage=<%=EndPageNum+1%>">下页</a>
<%end if%>
|<a href="Admin_Announce.asp">刷 新</a></td>
</tr>
</table>
</body>
</html>
<%
end if
rs.close
set rs=nothing
end if
%>
<%
function strFilter(str)
str=Replace(str,"'","''")
str=replace(str,"|","/")
str=Replace(str,"' ","'")
strFilter=str
end function
%>
<%
if request("Action")="Save" then
Title=strFilter(request("Title"))
Content=strFilter(request("Content"))
If Title="" Then
Response.Write "<script>alert(""请输公告标题!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
If Content="" Then
Response.Write "<script>alert(""请输公告内容!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
sql="select * from Announce "
rs.open sql,conn,3,2
rs.addnew
rs("Title")=Title
rs("Content")=Content
rs("time")=Date()
rs("Admin")=Session(GaobeiManageUser)
rs.update
rs.close
response.redirect "Admin_Announce.asp"
end if
%>
<%
if request("Action")="Modify" then
id=request.form("id")
Title=strFilter(request.form("Title"))
taxis=strFilter(request.form("taxis"))
Content=strFilter(request.form("Content"))
If Title="" Then
Response.Write "<script>alert(""请输公告标题!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
If Content="" Then
Response.Write "<script>alert(""请输公告内容!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
rs.open "select * from Announce where id="&id,conn,3,2
rs("Title")=Title
rs("Content")=Content
rs("Time")=Date()
rs("Admin")=Session(GaobeiManageUser)
'if request("SetMarquee")=1 then
'rs("Marquee")=1
'else
'rs("Marquee")=0
'end if
rs("taxis")=taxis
rs.update
rs.close
response.Redirect("Admin_Announce.asp")
end if
%>
<%
if request("Action")="Del" then
id=Request.QueryString("id")
delsql="delete from Announce where id="&id
conn.execute(delsql)
conn.close
response.redirect"Admin_Announce.asp"
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -