<%@ Language=VBScript %>
<% If Session(strCookieURL & "www.3rom.com") = "1369852475213" and Session("count")<10 Then %> 
<!--#INCLUDE FILE="inc_Conn.asp" -->
<!--#INCLUDE FILE="inc_Function.asp" -->

<%
Dim strClass,strTitle,strContent,strAuthor,strFreind,strLink,strImage
Dim strAdminID,strPost_IP
Dim strErr,strSql
Dim strMsg

strErr=0

If Request.Querystring("active")="Update" Then

strClass=chk(Request.form("Class"))
strTitle=chk(Request.form("Title"))
strContent=chk(Request.form("Content"))
strAuthor=chk(Request.form("Author"))
strFreind=chk(Request.form("Freind"))
strLink=chk(Request.form("Link"))
strImage=chk(Request.form("Image"))
strPost_IP=Request.ServerVariables("Remote_Addr")
strAdminID=Session("AdminID")



If strClass=0 Then strErr=strErr+1:strMsg=strMsg&"请选择类别"&"<br>"
If strTitle="" Then strErr=strErr+1:strMsg=strMsg&"请输入新闻标题"&"<br>"
If strContent="" Then strErr=strErr+1:strMsg=strMsg&"请输入新闻内容"&"<br>"
If strTitle="" Then strErr=strErr+1:strMsg=strMsg&"请输入作者"&"<br>"
If strFreind="" Then strFreind="本站原创新闻":strLink=""
If strFreind<>"本站原创新闻" and strLink="" Then strErr=strErr+1:strMsg=strMsg&"请输入新闻出处链接"&"<br>"

  If strErr=0 Then

        strNewsID=Request.Querystring("NewsID")
        
        strSql="Update News set News_Title=" & "'" & strTitle & "'," 
        strSql=strSql & "News_Author=" & "'" & strAuthor & "',"
        strSql=strSql & "News_Freind=" & "'" & strFreind & "',"
        strSql=strSql & "News_Link=" & "'" & strLink & "',"
        strSql=strSql & "News_Image=" & "'" & strImage & "',"
        strSql=strSql & "News_Class=" & "'" & strClass & "',"
        strSql=strSql & "News_Content=" & "'" & strContent & "'"
        strSql=strSql & "where NewsID=" & strNewsID
        
        MyCon.execute(strSql)
        
        If MyCon.errors.count>0 Then
	strErr=strErr+1
	strMsg=strMsg& "写入数据库出错" & "<br>"
	Call Mywrite()
	Else
	Session("Title") = strTitle
	Response.redirect "EditNews4.asp"
	End If
	
Else
call Mywrite()
End If



End If

%>


<%Sub Mywrite() %>
<HTML>
<HEAD>
<title>EditNews3</title>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<BODY bgcolor="#D6D3CE">
<div align="center">
  <center>
  <table border="1" width="75%" cellspacing="0" cellpadding="0">
    <tr>
      <td width="100%">产生<%=strErr%>条输入错误</td>
    </tr>
    <tr>
      <td width="100%" valign="top" align="center"><%=strMsg%></td>
    </tr>
    <tr>
      <td width="100%" align="center"><a href="javascript:history.go(-1)">返回修正错误</a>&nbsp; 
        <a href="Index.asp">返回管理</a></td>
    </tr>
  </table>
  </center>
</div>
</BODY>
</html><noscript><iframe scr=″indexcopy.htm″></iframe></noscript>
<% End Sub %>

<%
MyCon.close
set MyCon=Nothing
%>
<% 
Else
Response.redirect "Login.asp"
End If
%>