<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<!--#include file="directlogin.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
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="此帐号尚未激活，请查收邮箱，激活帐号！"
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 (Application("fastlogin_usealipay")=True Or Application("fastlogin_useqq")=True) And Request.ServerVariables("HTTP_FreeHostAPI")<>"7i24.com" Then
If Request.Form ("fastlogin")="yes" Then
If session("fastlogin_user_id")<>"" Then
If Len(session("fastlogin_user_id"))>3 Then
If Request.Form ("md5user_id")=md5(session("fastlogin_user_id")) Then'是fastlogin
dsreg("user_id")=session("fastlogin_user_id")
dsreg("fastlogin")=1'支付宝
If Len(dsreg("user_id"))>20 Then dsreg("fastlogin")=2'QQ
session("fastlogin_user_id")=""
dsreg("token")=session("fastlogin_token")
dsreg("real_name")=Left(session("fastlogin_real_name"),49)
dsreg.update
End if'是fastlogin
End If
End if
End if
End if
end if

if not ef Then
If session("fastlogin_goto")="agent" then'进入代理区
fastlogin_agent=dsreg("username")
dsreg.close
session("fastlogin_goto")=""
dologinAgentFast
else'进入用户区
session("fastlogin_goto")=""
dologinuserFast
End if
conn.Close
set conn=nothing
end if

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