<!--#include file="../inc/Bll.asp"-->
<!--#include file="../inc/Constant.asp"-->
<!--#include file="../inc/Md5.asp"-->
<!--#include file="../inc/App.asp"-->
<%

'本地数据注册
LocalLogin

dim t_UserID,t_UserName,t_UserPass,t_ReUserPass,t_UserNickName,t_UserMail,t_UserSex
'本地登录验证
Sub LocalValid()
	'验证数据
	if request.form("Method")<>"Bind" then Rws "alert('非法请求!');history.back();":Rend
	t_UserName = CheckSub(vAccount,request.form("UserName"),"账号格式有误") '验证账号
	t_UserPass = CheckSub(vPwd,request.form("UserPass"),"密码格式有误") '验证密码
	if request.form("GoUrl")<>"" then t_GoUrl = request.form("GoUrl")'来自页面
End Sub


'本站数据注册
Sub LocalLogin()
	RS_End
	if request.form("BindAccount")="yes" then
		'注册验证
		LocalValid
		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_OpenID")=Session("i_User_OpenID")
			RS("i_User_Sex")=Session(Session_UserSex_Arg)
			RS("i_User_NickName")=Session(Session_UserNickName_Arg)
			RS("i_User_Face")=Session(Session_UserFace_Arg)
			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()
			DB_CONN.EXECUTE("delete from [i_User_Info] where [i_User_Name]='"&Session("i_User_OpenID")&"'")
			'整合应用注册
			'i_Syn_Notifyt_Reg()
			'整合应用登录
			'i_Syn_Notifyt_Login()
			Response.Cookies("ishow")("iAutoLogin")="true":Response.Cookies("ishow")("iUserName")=t_UserName:Response.Cookies("ishow")("iUserPass")=t_UserPass:Response.Cookies("ishow").Expires= (now()+365)
			Rws "location.href='/i/"&SysConfig("i_Sys_Config_TemplatePath")&"/LoginAccess.html?"&t_GoUrl&"'":Rend
		else
			Rws "alert('登录失败,请检查');history.back();":Rend
		end if
		RS_End
	else
		'整合应用注册
		'i_Syn_Notifyt_Reg()
		'整合应用登录
		'i_Syn_Notifyt_Login()
		Rws "location.href='/i/"&SysConfig("i_Sys_Config_TemplatePath")&"/LoginAccess.html?"&t_GoUrl&"'":Rend
	end if
	
	
End Sub

%>