<!--#include file="conn.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
else
if request.cookies("sundxshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
end if
end if

dim newsid
newsid=SafeRequest("id",1)
if FormatSQL(SafeRequest("action",0))="save" then
if session("rank")>2 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权编辑新闻！');history.go(-1);</script>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from news where newsid="&newsid,conn,1,3
rs("newsname")=trim(request.form("newsname"))
rs("addname")=trim(request.form("addname"))
rs("categoryid")=trim(request.form("categoryid"))
Dim strNewsContent
For i = 1 To Request.Form("newscontent").Count 
strNewsContent = strNewsContent & Request.Form("newscontent")(i) 
Next 
rs("newscontent")=strNewsContent
rs("adddate")=now()
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript>alert('更改成功！');history.go(-1);</script>"
response.End
end if
%>
<title>编辑修改新闻</title>
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select * from news where newsid="&newsid,conn,1,1%>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" BGCOLOR="#39867B">
  <tr> 
    <td align="center"><font color="#ffffff">编辑修改新闻</font></td>
  </tr>
  <tr> 
    <td height="50" valign="top" bgcolor="#FFFFFF"> 
	<form name="form1" method="post" action="newsedit.asp?action=save&id=<%=newsid%>">
        <br>
        <table width="80%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
          <tr bgcolor="#FFFFFF"> 
            <td width="20%">&nbsp;新闻主题：</td>
            <td colspan="2">
              <input name="newsname" type="text" id="newsname" value=<%=trim(rs("newsname"))%>> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>发 表 人：</td>
            <td width="27%"> <input name="addname" type="text" id="addname" value=<%=trim(rs("addname"))%>> 
            </td>
            <td width="53%">新闻分类：<select name="categoryid">
               <option selected value="0">综合新闻</option>
                <%     
		set rs1=server.CreateObject("adodb.recordset")
		rs1.open "select * from category order by categoryorder",conn,1,1
        do while not rs1.eof
  response.write  "<option value="&rs1("categoryid")
  if rs1("categoryid")=rs("categoryid") then response.write " selected "
  response.write ">"&trim(rs1("category"))&"</option>"    
        rs1.movenext
        loop
        rs1.close
		set sr1 = Nothing
%><option value="1001" <% if rs1("categoryid")="1001" Then Response.write("Selected") %>>商品专题</option>
              </select></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td valign="top">新闻内容：</td>
            <td colspan="2"><INPUT type="hidden" name="newscontent" value="<% = Server.HtmlEncode(rs("newscontent")) %>">	
              <iframe ID="newscontent" src="htmledit/ewebeditor.asp?id=newscontent&style=standard" frameborder="0" scrolling="no" width="550" HEIGHT="350"></iframe> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF" align="center"> 
            <td height="28" colspan="3" bgcolor="#FFFFFF" style="PADDING-LEFT: 6px"> 
              <input type="submit" name="Submit" value="提交发表"> </td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
<br>
<!--#include file="footer.asp"-->
