<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<%
If session("agentusername")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf Request.form ("Mailfrom")<>"" And IsValidEmail(Request.form ("Mailfrom"))=false Then
	ef=True
	ec="无效邮箱！"
ElseIf Request.form ("Mailfrom")<>"" And  Request.form ("MailfromPass")="" Then
	ef=True
	ec="无效密码！"
ElseIf Request.form ("Mailfrom")<>"" And  Request.form ("MailfromServer")="" Then
	ef=True
	ec="无效服务器！"
ElseIf Request.form ("Mailfrom")<>"" And  Request.form ("emailendmessage")="" Then
	ef=True
	ec="无效结束信息！"
end if

if not ef then%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html5")%>　修改结果
<%=htmlwrite("html6")%>
<%
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
Set dsreg = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_AGENT where username='"&session("agentusername")&"'"
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		dsreg.Open Sql,conn,1,3
If dsreg.Eof Then
		ef=True
		ec="用户名不存在！"
		response.write ec
		response.end 
Else

If Request.form ("Mailfrom")<>"" then
dsreg("Mailfrom")=Request.Form ("Mailfrom")
dsreg("MailfromName")=Request.Form ("MailfromName")
dsreg("MailfromPass")=Request.Form ("MailfromPass")
dsreg("MailfromServer")=Request.Form ("MailfromServer")
dsreg("emailendmessage")=Request.Form ("emailendmessage")
If IsNumeric(Request.Form ("Mail_emailport")) Then dsreg("emailport")=Request.Form ("Mail_emailport")
dsreg("EnableSsl")=Request.Form ("Mail_EnableSsl")

Else
dsreg("Mailfrom")=null
dsreg("MailfromName")=null
dsreg("MailfromPass")=null
dsreg("MailfromServer")=null
dsreg("emailendmessage")=null

dsreg("emailport")=25
dsreg("EnableSsl")=false

End if



dsreg.update
response.write "<br><br><br>修改邮件发件人成功!"
end if
dsreg.close
set dsreg=nothing

%>
<%=htmlwrite("html7")%>
<%
end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
