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


dim t_UserName,t_UserPass,t_UserMail,t_AutoLogin,t_GoUrl,t_PayNum,t_IncomeNum
'本地登录验证
Sub LocalValid()
	'验证数据
	if request.form("Method")<>"Login" then Rws "alert('非法请求！');history.back();":Rend
	t_UserName = Get_SafeStr(CheckSub(vAccount,request.form("UserName"),"账号格式有误！")) '验证账号
	t_UserPass = Get_SafeStr(CheckSub(vPwd,request.form("UserPass"),"密码格式有误！")) '验证密码
	t_AutoLogin = request.form("_AutoLogin")
	if request.form("GoUrl")<>"" then t_GoUrl = request.form("GoUrl")'来自页面
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 a.[i_User_Name]='"&t_UserName&"' and a.[i_User_Pass]='"&MD5(t_UserPass)&"'" , DB_CONN , 1 , 3
	if RS.recordcount>0 then
		if RS("i_User_IsLock")=1 then Rws "alert('您的账户已被锁定,请联系管理员！');history.back();":Rend
		'登录成功
		RS("i_User_Online")=1
		RS("i_User_LastLoginTime")=now()
		RS("i_User_LoginIP")=get_IP()
		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_LogIP_Arg)=get_IP()
		Session(Session_LogTime_Arg)=now()
		t_PayNum = RS("i_User_PayNum")
		t_IncomeNum = RS("i_User_IncomeNum")
		Session(Session_UserPaymentLevel_Arg)=GetUserPaymentLevelInfo(t_PayNum,"i_User_PaymentLevel_Style")
		Session(Session_UserIncomeLevel_Arg)=GetUserInComeLevelInfo(t_IncomeNum,"i_User_InComeLevel_Style")
		
		if t_AutoLogin="1" then 
			Response.Cookies("ishow")("iAutoLogin")="true":Response.Cookies("ishow")("iUserName")=t_UserName:Response.Cookies("ishow")("iUserPass")=t_UserPass:Response.Cookies("ishow").Expires= (now()+365)
		else
			Response.Cookies("ishow")("iAutoLogin")="false"
		end if
		
		'整合应用登录
		i_Syn_Notify_Login t_UserName,t_UserPass
		
		Rws "location.href='/i/"&SysConfig("i_Sys_Config_TemplatePath")&"/LoginAccess.html?"&t_GoUrl&"'":Rend
	else
		Rws "alert('登录失败,请检查！');history.back();":Rend
	end if
	RS_End
End Sub

%>