<!--#include file="conn.asp"-->
<!--#include file="seeion.asp"-->
<!--#include file="fckeditor/fckeditor.asp"-->
<%
If request("submit") = "确定添加" Then
    title = request.Form("title")
    category = request.Form("category")
    author = request.Form("author")
    Source = request.Form("source")
    body = request.Form("body")
    If title = "" Then
        response.Write("<script language=javascript>alert('标题不能为空!');history.back(1)</script>")
        response.End()
    End If
    If body = "" Then
        response.Write("<script language=javascript>alert('内容不能为空!');history.back(1)</script>")
        response.End()
    End If
    Set rs = server.CreateObject("adodb.recordset")
    sql = "select * from news"
    rs.Open sql, conn, 1, 3
    rs.addnew
    rs("title") = title
    rs("category") = category
    rs("author") = author
    rs("source") = Source
    rs("body") = body
    rs.update
    Response.Write "<script>alert('成功添加新闻，点击“确定”继续添加！');window.location.href='news.asp';</script>"
End If
%>
<!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>网站后台管理系统</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--#include file="header.asp"-->
<div id="top_banner" class="layout"></div>
<div id="content" class="layout">
  <!--#include file="left.asp"-->
  <div id="right">
    <div class="right_title">
      <h2>添加新闻</h2>
    </div>
    <div class="right_body">
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
        <form method="post" >
          <tr>
            <td width="8%">新闻标题</td>
            <td width="92%"><input name="title" onblur='value=value.replace(/[>"<]/g,"")' type="text" size="60" /></td>
          </tr>
          <tr>
            <td>新闻分类</td>
            <td><select name="category">
              <%
Set rs = conn.Execute("select * from news_category")
Do While Not rs.EOF
    response.Write("<option value="""&rs("id")&""">"&rs("title")&"</option>")
    rs.movenext
Loop
rs.Close
Set rs = Nothing

%>
            </select></td>
          </tr>
          <tr>
            <td>作　　者</td>
            <td><input name="author" type="text" value="cherry"/></td>
          </tr>
          <tr>
            <td>来　　源</td>
            <td><input name="source" type="text" value="本站" size="10" /></td>
          </tr>
          <tr>
            <td height="258">内容详情</td>
            <td><%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "fckeditor/"
oFCKeditor.ToolbarSet = "Default"
oFCKeditor.Width = "100%"
oFCKeditor.Height = "360"
oFCKeditor.Value = ""
oFCKeditor.Create "body"
%>
              </td>
          </tr>
          <tr>
            <td colspan="2"><p class="submit">
              <input name="submit" type="submit" value="确定添加" />
            </p></td>
          </tr>
        </form>
      </table>
    </div>
  </div>
  <div class="clear"></div>
</div>
<!--#include file="footer.asp"-->
