<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("cansetnews")="" Then
	ef=True
	ec="您没有此操作的权限。"
ElseIf Request.Form ("title")="" Then
	ef=True
	ec="标题没填！"
ElseIf Request.Form ("body")="" Then
	ef=True
	ec="内容没填！"
ElseIf Request("id")<>"" and not IsNumeric(Request("id")) Then
	ef=True
	ec="编号必须是数字"
ElseIf Request.Form ("ismod")="y" and request.Form ("id")="" Then
	ef=True
	ec="编号ID没填！"
end if
if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_News where username='freehost' and id='"&Request("id")&"'"
		ds.Open Sql,conn,1,3
if Request.Form ("ismod")="y" and ds.Eof then
	ef=True
	ec="没找到要修改的ID！"
end if

if not ef then

if Request.Form ("ismod")<>"y" then ds.AddNew

scon=Request.Form ("body")

''response.write Request.Form ("body")
''response.end

ds("username")="freehost"
ds("title")=request.Form ("title")
ds("con")=scon
ds("posttime")=NOW
if  IsNumeric(Request.Form("orderbyid")) then
ds("orderbyid")=Request.Form("orderbyid")
else
ds("orderbyid")=0
end if

if  IsNumeric(Request.Form("typeid")) then
ds("typeid")=Request.Form("typeid")
else
ds("typeid")=0
end If

if  IsNumeric(Request.Form("type1")) then
ds("type1")=Request.Form("type1")
else
ds("type1")=0
end If

If ds("type1")>0 Then
type2=Request.Form("type2")
type2=Replace(type2," ","")
type2=Replace(type2,",","")
if  IsNumeric(type2) then
ds("type2")=type2
else
ds("type2")=0
end If
End if

ds.Update
ds.Close
set ds=nothing
conn.Close 
set conn=nothing
Response.Redirect "setnews.asp"
end if

end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>