<%
set rs=nothing
end if
%>
<table border="0" cellspacing="1" cellpadding="0" width="87%">
<tr>
<td width="100%" background="images/tbg1.gif" align="right">
<select size="1" name="tt" onChange="location.href=this.options[this.selectedIndex].value">
<option>跳转</option>
<%
tp=0
do while not tp=pc-1
%>
<option value="adnews.asp?page=<%=tp+1%>"><%=tp+1%></option>
<%
tp=tp+1
loop
%>
</select>
<%
if page<>1 then
response.write "[<a href='adnews.asp?page=1'>首页</a>] "
response.write "[<a href='adnews.asp?page="&(page-1)&"'>上一页</a>] "
end if
if page<>pc then
response.write "[<a href='adnews.asp?page="&(page+1)&"'>下一页</a>] "
response.write "[<a href='adnews.asp?page="&pc&"'>尾页</a>] "
end if
%>
</td>
</tr>
</table>
<%
if request("turnin")="提 交" and request("title")<>""and session("add")=true then
title=server.htmlencode(request("title"))
message=server.htmlencode(request("message"))
message=replace(message,vbcrlf,"<br>")
message=replace(message," "," ")
message=replace(message,"'","''")
conn.execute("insert into news(title,msg) values('"&title&"','"&message&"')")
session("add")=false
end if
if request("editnews")="确 定" and request("etitle")<>"" then
etitle=server.htmlencode(request("etitle"))
emessage=server.htmlencode(request("emessage"))
emessage=replace(emessage,vbcrlf,"<br>")
emessage=replace(emessage," "," ")
emessage=replace(emessage,"'","''")
if emessage<>"" then
conn.execute("update news set title='"&etitle&"',msg='"&emessage&"',mt=now() where id="&session("eid")&"")
else
conn.execute("update news set title='"&etitle&"',mt=now() where id="&session("eid")&"")
end if
end if
if request("del")<>"" then
conn.execute("delete from news where id="&request("del")&"")
end if
%>
<script language="javascript">
<!--
function winopen(url)
{
window.open(url,"显示新闻","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=550,height=300,top=100,left=125");
}
//-->
</script>
<body background="images/bg.gif">
<p align="center"><font class="3dfont0" face="楷体_GB2312" size="5" color="#000080">新闻管理页面</font>
<br>
<%
if request("add")="" and request("edit")="" then
set rs=server.createobject("adodb.recordset")
sql = "select * from news order by mt desc"
rs.open sql,conn,3
mypage=request("page")
if not isnumeric(mypage) or mypage="" then mypage=1
rs.pagesize=12
page=clng(mypage)