<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostEmail.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%

AntiCC=false'改成true将限制二秒只能访问一个页面

If AntiCC=True Then
if DateDiff("s",Application("AntiCC_Time_aws"),NOW )<2 Then
Response.Redirect "e.asp?e=系统繁忙，请您稍等三秒再访问，谢谢您的支持。"
response.end
Else
Application("AntiCC_Time_aws")=now
End if
End if

If session("username")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf trim(Request.Form ("title"))=""  and Request("op")="" Then
	ef=True
	ec="标题没填！"
ElseIf trim(Request.Form ("con"))="" and Request("op")="" Then
	ef=True
	ec="内容没填！"
elseIf checkscript(Request.Form ("title")) Then
	ef=True
	ec="标题有非法字符！如<>script"
elseIf checkscript(Request.Form ("con")) Then
	ef=True
	ec="内容有非法字符！如<>script"
ElseIf Request("id")<>"" and not IsNumeric(Request("id")) Then
	ef=True
	ec="编号必须是数字"
ElseIf Request("type1")<>"" and not IsNumeric(Request("type1")) Then
	ef=True
	ec="编号必须是数字"
ElseIf Request.Form ("Submit")="修改" 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_online_aws where username='"&session("username")&"' and id='"&Request("id")&"'"
		ds.Open Sql,conn,1,3
if Request("Submit")="继续发表" and ds.Eof then
	ef=True
	ec="没找到要继续发表的ID！"
end if
end if

if not ef then
if Request("Submit")<>"继续发表" And Request("Submit")<>"again" then
ds.AddNew
ds("username")=session("username")
ds("title")=trim(trim(Request.Form ("title")))
ds("con")=trim(Request.Form ("con"))
ds("status")="新问题"
if session("agentname")<>"n" and session("agentname")<>session("username") then
ds("agent1")=session("agentname")

  Set dsagent = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_AGENT where username='"&ds("agent1")&"'"
		dsagent.Open Sql,conn,1,1
If Not dsagent.Eof Then
If dsagent("awstoadmin")=True Then
ds("agent1")="n"
ds("agent2")=dsagent("username")
Dim awstoadmin
awstoadmin=true
End if
end If
dsagent.close

else
ds("agent1")="n"
end if
else
if Request("op")<>"close" then
'ds("username")=session("username")
'ds("title")=trim(trim(Request.Form ("title")))
ds("con")=ds("con")&vbcrlf&"-------"&session("username")&" 回复("&now&")-------"&vbcrlf&(Request.Form ("con"))
ds("status")="待回复"
else
ds("status")="已结束"
end if
end if
ds("posttime")=NOW
ds("type1")=Request.Form ("type1")

If (ds("agent1")="n" Or awstoadmin=true) And Not IsNull(Application("admemail")) Then
ret=SendJmail(ds("username"),Application("Mail_from"),Application("Mail_fromName"),Application("admemail"),"新问题:"&ds("title"),now&" 新问题，用户名为："&ds("username")&" 内容为："&trim(Request.Form ("con")),Application("Mail_fromServer"),Application("Mail_fromPass"),Application("Mail_emailport"),Application("Mail_EnableSsl"))
End if

If (ds("agent1")="n" Or awstoadmin=true) Then
Application("noticemesg")=Application("noticemesg")&"　用户提交了新的问题。"
End if

ds.Update
ds.Close
set ds=nothing
conn.Close 
set conn=nothing

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