<!--#include file="../inc/Bll.asp"-->
<!--#include file="../inc/Constant.asp"-->
<!--#include file="../inc/Md5.asp"-->
<!--#include file="../inc/App.asp"-->
<%
'注册验证
LocalValid
'整合应用登录
'i_Syn_Notifyt_Login()
'本地数据登录
LocalLogin

dim t_UserName,t_UserPass,t_UserMail,t_AutoLogin,t_GoUrl
'本地登录验证
Sub LocalValid()
	'验证数据
	if request.QueryString("ac")<>"Login" then Rw "alert('非法请求!');":Rend
	t_UserName = Get_SafeStr(CheckSub2(vAccount,request.QueryString("UserName"),"账号格式有误")) '验证账号
	t_UserPass = Get_SafeStr(CheckSub2(vPwd,request.QueryString("UserPass"),"密码格式有误")) '验证密码
End Sub

'本站数据注册
Sub LocalLogin()
	RS_End
	RS.OPEN "select top 1 * from [i_User_Info] a join [i_Sys_Room] b on a.[i_User_ID]=b.[i_Sys_Room_AdminUserID] where [i_User_Name]='"&t_UserName&"' and [i_User_Pass]='"&MD5(t_UserPass)&"'" , DB_CONN , 1 , 3
	if RS.recordcount>0 then
		if RS("i_User_IsLock")=1 then Rw "alert('您的账户已被锁定,请联系管理员!');":Rend
		'登录成功
		RS("i_User_Online")=1
		RS("i_User_LastLoginTime")=now()
		RS("i_User_LoginIP")=getIP()
		RS.Update()
		Session(Session_UserID_Arg)=RS("i_User_ID")
		Session(Session_UserName_Arg)=RS("i_User_Name")
		Session(Session_UserNickName_Arg)=RS("i_User_NickName")
		Session(Session_UserSex_Arg)=RS("i_User_Sex")
		Session(Session_UserClass_Arg)=RS("i_User_Class")
		Session(Session_UserFace_Arg)=RS("i_User_Face")
		Session(Session_RoomID_Arg)=RS("i_Sys_Room_ID")		
		Session(Session_UserPaymentLevel_Arg)=GetUserPaymentLevelInfo(RS("i_User_PayNum"),"i_User_PaymentLevel_Style")
		Session(Session_UserIncomeLevel_Arg)=GetUserInComeLevelInfo(RS("i_User_IncomeNum"),"i_User_InComeLevel_Style")
		Rw "iInfo.IsLogin=true;"
		Rw "iInfo.UserID='"&Session(Session_UserID_Arg)&"';"
		Rw "iInfo.RoomID='"&Session(Session_RoomID_Arg)&"';"
		Rw "iInfo.UserNickName='"&Session(Session_UserNickName_Arg)&"';"
		Rw "iInfo.FacePic='"&Session(Session_UserFace_Arg)&"';"
		Rw "iInfo.LevelClass='"&Session(Session_UserPaymentLevel_Arg)&"';"
		Rw "iInfo.InComeClass='"&Session(Session_UserIncomeLevel_Arg)&"';"
		Rend
	else
		Rw "alert('登录失败,请检查');":Rend
	end if
	RS_End
End Sub

Function getIP() 
	Dim strIPAddr 
	If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then 
		strIPAddr = Request.ServerVariables("REMOTE_ADDR") 
	ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then 
		strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1) 
	ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then 
		strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1) 
	Else 
		strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
	End If 
	getIP = Trim(Mid(strIPAddr, 1, 30)) 
End Function
%>