<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%
if Application("dblinker")=true then
response.write "请您检查数据库连接，<font color=red>改正后请您重启IIS</font>。<br><br>出错信息为："&Application("errdec")&"<br><br>"
If InStr(Application("errdec"),"不存在或拒绝访问") Then
response.write "原因：无法连接您的SQL数据库，请您检查数据库是否已启动，如果您的数所据库已启动，请检查您的数据库的1433端口是否被您改过造成了出错。"
End If
If InStr(Application("errdec"),"法打开登录") Then
response.write "原因：您的数据库没有正确还原，请您参考以下文章正确还原FreeHost数据库：<a href='http://sys.7i24.com/system/support/show.asp?id=106151742419'>http://sys.7i24.com/system/support/show.asp?id=106151742419</a>"
response.end
End if
If InStr(Application("errdec"),"登录失败") Then
response.write "原因："&Server.Mappath("Global.asa")&" 中的数据库连接密码不正确，请您用记事本打开这个文件，按里面的说明改正确密码。如果您的Freehost数据库尚未还原，请参考以下文件正确还原数据库：<a href='http://sys.7i24.com/system/support/show.asp?id=106151742419'>http://sys.7i24.com/system/support/show.asp?id=106151742419</a>"
End If
response.end
end If
if Application("updateer")=true then
response.write "<a href=/update/3.7.asp>请您点这儿来运行update目录中的asp文件升级>>>></a>，运行完后请您重启IIS。"
response.end
end If
if Application("admuserer")=true then
response.write "您修改了默认的Freehost管理员帐号造成了出错，请您先恢复数据库中的管理员帐号，然后请您重启IIS就会恢复正常。"
response.end
end if
if Application("firstuse")=true then
response.write "<meta http-equiv=Content-Type content=text/html; charset=gb2312>未找到网站模板，如果您是首次访问主控网站，请您先访问 <a href='/adm/'>管理区>>>>>>></a> ，提交模板后才能看到网站的首页，管理区默认的用户名是freehost密码默认是7i24freehost"
response.end
end if
if Application("agentnodefault")=true then
response.write "管理员没有设置默认的代理用模板，您先访问管理区，站点管理，模板管理中，选择其中一个模板为代理默认用的模板，提交模板后就会正常。"
response.end
end if
if left(Request.ServerVariables("SERVER_NAME"),5)="mail." Then
If RegExpTest("[.A-Za-z0-9--]",Request.ServerVariables("SERVER_NAME")) then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
Set dspdallemail = Server.CreateObject("ADODB.Recordset")
		Sql="Select id from FreeHost.FreeHost_Product_ALLEmail where emailname='"&Application("admmailname")&"@"&Right(Request.ServerVariables("SERVER_NAME"),Len(Request.ServerVariables("SERVER_NAME"))-5)&"'"
		dspdallemail.Open Sql,conn,1,1
if not dspdallemail.Eof Then
dspdallemail.close
Set dspdallemail=Nothing
conn.close
Set conn=Nothing
Response.Redirect "http://"&Request.ServerVariables("SERVER_NAME")&":8888/"
Else
dspdallemail.close
Set dspdallemail=Nothing
conn.close
Set conn=Nothing
session("nomailname")=true
server.Transfer "nohost.asp"
End if
End If
End if


if Request.ServerVariables("SERVER_NAME")=Application("ctldomain") then server.Transfer "/hostadm/default.asp"
if Request.ServerVariables("SERVER_NAME")=Application("VPScpdomain") then server.Transfer "/vpsadm/default.asp"
'if left(Request.ServerVariables("SERVER_NAME"),3)="cp." then server.Transfer "/hostadm/default.asp"
'if left(Request.ServerVariables("SERVER_NAME"),4)="dns." then server.Transfer "/dns/default.asp"
'if left(Request.ServerVariables("SERVER_NAME"),6)="agent." then server.Transfer "/agent/default.asp"
if Application("nohost")=true and session("nohost")=true then server.Transfer "nohost.asp"
if Application("nohost")=true and Request.ServerVariables("LOCAL_ADDR")=Request.ServerVariables("SERVER_NAME") then server.Transfer "nohost.asp"
if Application("nohost")=true and IsNumeric(replace(Request.ServerVariables("LOCAL_ADDR"),".","")) and IsNumeric(replace(Request.ServerVariables("SERVER_NAME"),".","")) then server.Transfer "nohost.asp"
if Application("indexsame")=false and session("ism")=true then server.Transfer "home.asp"
htmlwrite("html1")

Function RegExpTest(patrn, strng)
  Dim regEx
  Set regEx = New RegExp
  regEx.Pattern = patrn
  regEx.IgnoreCase = False
  RegExpTest = regEx.Test(strng)
End Function 
%>