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

'If Request.ServerVariables("HTTP_X_FORWARDED_FOR")  <> "" Then
'   Response.write "禁止代理访问"
 '  Response.end
'End If




session.Timeout =25
If Request.Form ("username")="" or RegExpTest("[^A-Za-z0-9]",Request.Form ("username")) Then
	ef=True
	ec="用户名没填或非法！"
elseIf Request.Form ("password")="" Then
	ef=True
	ec="密码没填！"
End if


'验证会员资格
If not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
  Set dsreg = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_USER where username='"&Request.Form ("username")&"'"
		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="会员名不存在或密码出错了！"
end if
end If

if not ef then
If Application("agnchangelogin")=True Then
if Request.ServerVariables("HTTP_FreeHostAPI")<>"7i24.com" Then
If session("agentname")<>dsreg("agent1") Then
		ef=True
		ec=ec&"管理员限制了不允许交叉登陆！"
End If
End if
End If

'启用以下代码可以限制直接用户在API代理中登陆
'if Request.ServerVariables("HTTP_FreeHostAPI")="7i24.com" Then
'if dsreg("agent1")="n" Then
'		ef=True
'		ec=ec&"直接用户请在主站登陆！"
'End If
'End If

End If

if not ef then
if md5(Request.Form ("password"))<>dsreg("password") then
		ef=True
		ec="密码不正确！"
else
    session("agentusername")=""
	session("admau")=""
	session("agentname")="n"'200-11-30修改bug加上的。

if Application("emailau")=true then
if dsreg("emailau")="n" then 
		ef=True
		ec="此帐号尚未激活，请查收邮箱，激活帐号！"
session.Abandon()
Response.Redirect "e.asp?e="&ec
end if
end If

if not ef then
If dsreg("haveblock")=true Then
		ef=True
		ec="此帐号已锁定,不允许登陆,请联系管理员处理！"
session.Abandon()
Response.Redirect "e.asp?e="&ec
End if
end If

if Application("smsau")=true then
if dsreg("checkmobiok")=false then 
'session.Abandon()
    session("SMSAUusername")=dsreg("username")
Response.Redirect "/user/checkmobi.asp"
end if
end if



end if
end If

if not ef then
if Application("ZM_Use")=true then'2018进入芝麻部分
if Application("ZM_LoginInmustpass")=true then'2018进入芝麻部分
If Not dsreg("ZM_state")="实名验证成功" Then 
session("ZM_tempusername")=dsreg("username")
Response.Redirect "/realname/default.asp"
End if
End if
End if
end If

if not ef then
If IsNull(dsreg("usermoney")) Then
		ef=True
		ec="此帐号金额为空,不允许登陆,请联系管理员处理！"
End if
end If



if not ef then
If Request.Form ("timeout")="y" Then
session.Timeout =45
End if
end if

if not ef then
if dsreg("agent1")<>"n" then
 Set dsagent = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_AGENT where username='"&dsreg("agent1")&"'"
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		dsagent.Open Sql,conn,1,1
If dsagent.Eof Then
		ef=True
		ec="代理会员名不存在或密码出错了！"
Response.Redirect "e.asp?e="&ec
else
session("agenttype")=dsagent("agenttype")
session("agentname")=dsreg("agent1")
haveclosehtml=dsagent("haveclosehtml")
end If

	Set dsstyle = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_HtmlStyle where username='"&dsreg("agent1")&"' and nowuse='1'"
		dsstyle.Open Sql,conn,1,1
If not dsstyle.Eof Then'切换
if Request.ServerVariables("HTTP_FreeHostAPI")<>"7i24.com" Then
session("html1")=dsstyle("html1")
session("html2")=dsstyle("html2")
session("html3")=dsstyle("html3")
session("html4")=dsstyle("html4")
session("html5")=dsstyle("html5")
session("html6")=dsstyle("html6")
session("html7")=dsstyle("html7")
session("html8")=Application("html8")
session("html9")=Application("html9")
session("html10")=Application("html10")
session("html11")=dsstyle("html11")
session("html12")=dsstyle("html12")
session("html13")=dsstyle("html13")
session("html14")=dsstyle("html14")
session("html15")=dsstyle("html15")
session("html16")=dsstyle("html16")
session("html17")=dsstyle("html17")
session("html18")=dsstyle("html18")
session("html19")=dsstyle("html19")
session("html20")=dsstyle("html20")
session("html21")=dsstyle("html21")
session("html22")=dsstyle("html22")
session("html23")=dsstyle("html23")
session("html24")=dsstyle("html24")
session("html25")=dsstyle("html25")

session("html26")=dsstyle("html26")
session("html27")=dsstyle("html27")
session("html28")=dsstyle("html28")
session("html29")=dsstyle("html29")
session("html30")=dsstyle("html30")
session("html31")=dsstyle("html31")
session("html32")=dsstyle("html32")
End if
session("ism")=false
else



Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_HtmlStyle where username='"&dsagent("agent1")&"' and nowuse='1'"'上级代理中查
		ds.Open Sql,conn,1,1
if not ds.eof Then
if Request.ServerVariables("HTTP_FreeHostAPI")<>"7i24.com" Then
session("html1")=ds("html1")
session("html2")=ds("html2")
session("html3")=ds("html3")
session("html4")=ds("html4")
session("html5")=ds("html5")
session("html6")=ds("html6")
session("html7")=ds("html7")
session("html8")=Application("html8")
session("html9")=Application("html9")
session("html10")=Application("html10")
session("html11")=ds("html11")
session("html12")=ds("html12")
session("html13")=ds("html13")
session("html14")=ds("html14")
session("html15")=ds("html15")
session("html16")=ds("html16")
session("html17")=ds("html17")
session("html18")=ds("html18")
session("html19")=ds("html19")
session("html20")=ds("html20")
session("html21")=ds("html21")
session("html22")=ds("html22")
session("html23")=ds("html23")
session("html24")=ds("html24")
session("html25")=ds("html25")

session("html26")=ds("html26")
session("html27")=ds("html27")
session("html28")=ds("html28")
session("html29")=ds("html29")
session("html30")=ds("html30")
session("html31")=ds("html31")
session("html32")=ds("html32")
End if

Else

Set ds = Server.CreateObject("ADODB.Recordset")	
'		Sql="Select * from FreeHost.FreeHost_HtmlStyle where username='"&session("agentname")&"' and nowuse='1'"'公共模板
		Sql="Select * from FreeHost.FreeHost_HtmlStyle where username='freehost' and agentdefault='1' order by id desc"
		ds.Open Sql,conn,1,1
if not ds.eof Then
if Request.ServerVariables("HTTP_FreeHostAPI")<>"7i24.com" Then
session("html1")=ds("html1")
session("html2")=ds("html2")
session("html3")=ds("html3")
session("html4")=ds("html4")
session("html5")=ds("html5")
session("html6")=ds("html6")
session("html7")=ds("html7")
session("html8")=Application("html8")
session("html9")=Application("html9")
session("html10")=Application("html10")
session("html11")=ds("html11")
session("html12")=ds("html12")
session("html13")=ds("html13")
session("html14")=ds("html14")
session("html15")=ds("html15")
session("html16")=ds("html16")
session("html17")=ds("html17")
session("html18")=ds("html18")
session("html19")=ds("html19")
session("html20")=ds("html20")
session("html21")=ds("html21")
session("html22")=ds("html22")
session("html23")=ds("html23")
session("html24")=ds("html24")
session("html25")=ds("html25")

session("html26")=ds("html26")
session("html27")=ds("html27")
session("html28")=ds("html28")
session("html29")=ds("html29")
session("html30")=ds("html30")
session("html31")=ds("html31")
session("html32")=ds("html32")
End If



else
'session("ism")=false
if Request.ServerVariables("HTTP_FreeHostAPI")<>"7i24.com" Then
session("html1")=Application("agnhtml1")
session("html2")=Application("agnhtml2")
session("html3")=Application("agnhtml3")
session("html4")=Application("agnhtml4")
session("html5")=Application("agnhtml5")
session("html6")=Application("agnhtml6")
session("html7")=Application("agnhtml7")
session("html8")=Application("agnhtml8")
session("html9")=Application("agnhtml9")
session("html10")=Application("agnhtml10")
session("html11")=Application("agnhtml11")
session("html12")=Application("agnhtml12")
session("html13")=Application("agnhtml13")
session("html14")=Application("agnhtml14")
session("html15")=Application("agnhtml15")
session("html16")=Application("agnhtml16")
session("html17")=Application("agnhtml17")
session("html18")=Application("agnhtml18")
session("html19")=Application("agnhtml19")
session("html20")=Application("agnhtml20")
session("html21")=Application("agnhtml21")
session("html22")=Application("agnhtml22")
session("html23")=Application("agnhtml23")
session("html24")=Application("agnhtml24")
session("html25")=Application("agnhtml25")

session("html26")=Application("agnhtml26")
session("html27")=Application("agnhtml27")
session("html28")=Application("agnhtml28")
session("html29")=Application("agnhtml29")
session("html30")=Application("agnhtml30")
session("html31")=Application("agnhtml31")
session("html32")=Application("agnhtml32")
End if
session("ism")=true'如果没有定义htmlsytle
end if

end if

'----2005-5-10
end if
dsstyle.close
set dsstyle=nothing
end if
end if


if not ef Then

If haveclosehtml=True Then
if Request.ServerVariables("HTTP_FreeHostAPI")<>"7i24.com" Then
session("html1")=Application("html1")
session("html2")=Application("html2")
session("html3")=Application("html3")
session("html4")=Application("html4")
session("html5")=Application("html5")
session("html6")=Application("html6")
session("html7")=Application("html7")
session("html8")=Application("html8")
session("html9")=Application("html9")
session("html10")=Application("html10")
session("html11")=Application("html11")
session("html12")=Application("html12")
session("html13")=Application("html13")
session("html14")=Application("html14")
session("html15")=Application("html15")
session("html16")=Application("html16")
session("html17")=Application("html17")
session("html18")=Application("html18")
session("html19")=Application("html19")
session("html20")=Application("html20")
session("html21")=Application("html21")
session("html22")=Application("html22")
session("html23")=Application("html23")
session("html24")=Application("html24")
session("html25")=Application("html25")
session("html26")=Application("html26")
session("html27")=Application("html27")
session("html28")=Application("html28")
session("html29")=Application("html29")
session("html30")=Application("html30")
session("html31")=Application("html31")
session("html32")=Application("html32")
End if
End if

session("username")=dsreg("username")
session("password")=dsreg("password")
session("usermoney")=dsreg("usermoney")
session("atspace")="用户区"
session("lastusetime")=dsreg("lastuse")
dsreg("lastuse")=now
if session("agentname")=session("username") then
session("AgnRunasUser")=True
else
session("AgnRunasUser")=false
end if
dsreg.update
if session("login_tar")<>"" then
tourl=session("login_tar")&"?"&session("login_QueryString")
session("login_tar")=""
Response.Redirect tourl
end if
FreeHost_Loginlog session("username"),"用户"

If Request("goto")="beian" Then Response.Redirect "/beianuser/info.asp"
If Application("opencheckmobi")=true Then
If dsreg("checkmobiok")=false Then
If dsreg("wantcheckmobiok")=True Then
Response.Redirect "checkmobi.asp"
End if
End if
End if

Response.Redirect "logininfo.asp"
dsreg.close
conn.Close
set conn=nothing
end if

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