<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn.asp"-->
<!--#include file="../seeion.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=site_info("title")%>-后台管理系统</title>
<link href="../css.css" rel="stylesheet" type="text/css" />
</head>
<body>

    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="52"><img src="../images/main_1.jpg" width="52" height="55" /></td>
              <td background="../images/main_2.jpg" class="title1">添加新闻</td>
              <td width="52"><img src="../images/main_3.jpg" width="52" height="55" /></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="15" background="../images/main_4.gif">&nbsp;</td>
              <td background="../images/main_9.gif"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
                <form action="news_add.asp?add=ok" method="post" name="news_add" id="news_add">
                  <tr>
                    <th width="80" class="td">新闻标题：</th>
                    <td class="td"><input name="title" type="text" class="input" size="30" /></td>
                  </tr>
                  <tr>
                    <th class="td">新闻分类：</th>
                    <td class="td"><select name="category" class="input">
                        <%
Dim rsc
Set rsc = server.CreateObject("adodb.recordset")
rsc.Open "select * from news_category", conn, 1, 1
While Not rsc.EOF
    response.Write("<option value=""" & rsc("id") & """>" & rsc("title") & "</option>")
    rsc.movenext
Wend
rsc.Close
Set rsc = Nothing

%>
                    </select></td>
                  </tr>
                  <tr>
                    <th class="td">新闻关键词：</th>
                    <td class="td"><input name="keywords" type="text" class="input" size="50" /></td>
                  </tr>
                  <tr>
                    <th class="td">关键词描述：</th>
                    <td class="td"><input name="description" type="text" class="input" size="50" /></td>
                  </tr>
                  <tr>
                    <th class="td">发布者：</th>
                    <td class="td"><input name="author" type="text" class="input" value="<%=session("user_name")%>" /></td>
                  </tr>
                  <tr>
                    <th class="td">新闻来源：</th>
                    <td class="td"><input name="source" type="text" class="input" value="本站" size="50" /></td>
                  </tr>
                  <tr>
                    <th class="td">详细内容：</th>
                    <td class="td"><input type="hidden" name="body" />
                        <iframe id="eWebEditor1" src="../ewebeditor/ewebeditor.htm?id=body&amp;style=pcfinal" frameborder="0" scrolling="No" width="100%" height="350"></iframe></td>
                  </tr>
                  <tr>
                    <th class="td">新闻推荐：</th>
                    <td class="td"><input name="recommendatory" type="radio" value="1" />
                      推荐
                      <input name="recommendatory" type="radio" checked="checked" value="0" />
                      不推荐</td>
                  </tr>
                  <tr>
                    <td class="td"><p class="submit">&nbsp;</p></td>
                    <td class="td"><span class="submit">
                      <input name="submit" type="submit" class="button" value="确认添加" />
                    </span></td>
                  </tr>
                </form>
              </table></td>
              <td width="15" background="../images/main_5.gif">&nbsp;</td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="52"><img src="../images/main_6.gif" width="52" height="16" /></td>
              <td background="../images/main_7.gif" width="100%"></td>
              <td width="52"><img src="../images/main_8.gif" width="52" height="16" /></td>
            </tr>
        </table></td>
      </tr>
    </table>
</body>
</html>
<%
If Request.QueryString("add") = "ok" Then
    Set rs = server.CreateObject("adodb.recordset")
    sql = "select * from news"
    rs.Open sql, conn, 1, 3
    title = request.Form("title")
    category = request.Form("category")
    keywords = request.Form("keywords")
    Description = request.Form("description")
    author = request.Form("author")
    Source = request.Form("source")
    body = request.Form("body")
    recommendatory = request.Form("recommendatory")
    If title = "" Then
        response.Write("<script language=javascript>alert('标题不能为空！');history.go(-1)</script>")
        response.End
    End If
    If body = "" Then
        response.Write("<script language=javascript>alert('详细内容不能为空！');history.go(-1)</script>")
        response.End
    End If
    rs.addnew
    rs("title") = title
    rs("category") = category
    rs("keywords") = keywords
    rs("description") = Description
    rs("author") = author
    rs("source") = Source
    rs("body") = body
    rs("recommendatory") = recommendatory
    rs.update
    rs.Close
    Set rs = Nothing
    conn.Close
    Set rs = Nothing
    Response.Write "<script language=javascript>alert('添加成功！');window.location.href='news_add.asp';</script>"
End If
%>

<!--#include file="../close.asp"-->
