<!--#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
if request.form("action") = "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",conn,1,3
rs.addnew
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("viewnum")=0
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript>alert('新闻添加成功！');history.go(-1);</script>"
response.End
end if
%>
<title>添加首 页新闻</title>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" BGCOLOR="#39867B">
  <tr> 
    <td height="20" align="center"><font color="#ffffff">添加网站新闻</font></td>
  </tr>
  <tr> 
    <td height="168" valign="top" bgcolor="#FFFFFF"> 
	<form name="form1" method="post" action="addnews.asp">
        <table width="80%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
          <tr bgcolor="#FFFFFF"> 
            <td width="20%">新闻主题：</td>
            <td colspan="2"> <input name="newsname" type="text" id="newsname"> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>发 表 人：</td>
            <td width="29%"> <input name="addname" type="text" id="addname" value="<% = session("admin") %>"> 
            </td>
            <td width="51%">新闻分类： <select name="categoryid">
                <%set rs=server.CreateObject("adodb.recordset")
                rs.Open "select categoryid,category from category order by categoryorder",conn,1,1
                if rs.eof and rs.bof then
                response.Write "<option value=0>综合新闻</option>"
                else
				response.Write "<option value=0>综合新闻</option>"
                do while not rs.eof
                %>
                <option value="<%=int(rs("categoryid"))%>"><%=trim(rs("category"))%></option>
                <%rs.movenext
                loop
                rs.close
                set rs=nothing
                end if%>
               <option value=1001>商品专题</option>
              </select></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td valign="top">新闻内容：</td>
            <td colspan="2"> <INPUT type="hidden" name="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"> 
            <td height="28" colspan="3" align="center"> <input name="action" type="hidden" value="save"> 
              <input type="submit" name="Submit" value="提交发表"> </td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
<!--#include file="footer.asp"-->
