<!--#include file="include/conn.asp"-->
<%
If session("openid")="" Then 
	Call Alert ("非法QQ登录.","/")
End If
	Set oRs=server.createobject("adodb.recordset")
	sSql="Select * from [LstUser] where openid='"&session("openid")&"' "
	oRs.open sSql,oconn,1,3
	If not oRs.eof then

		Dim oRsqq
		Set oRsqq=server.createobject("adodb.recordset")
		sSql="select top 1 * from [LstUser] where openid='"&session("openid")&"'"
		oRsqq.open sSql,oconn,1,1
		If CLng(oRsqq("UsrState"))= 0 Then
			Call Alert ("很抱歉,您的帐号被锁定,有问题请咨询管理员.","-1")
		Else
			session("userid")=oRsqq("Id")
			session("username")=oRsqq("Usrname")
		End If
	Else
		oRs.addnew
		oRs("UsrEmail")=Usrmail
		oRs("UsrName")=session("openidnn")
		oRs("UsrPass")=md5("123456",32)

		oRs("UsrTel")=UsrTel
		oRs("UsrAddress")=UsrAddress
		oRs("UsrFax")=UsrFax
		oRs("UsrZip")=UsrZip

		oRs("UsrMoney")=0
		oRs("UsrState")=1
		oRs("UsrLogintime")=now()
		oRs("UsrAddtime")=now()
		oRs("openid")=session("openid")
		oRs.update
		session("userid")=oRs("Id")
		session("username")=oRs("Usrname")
		oRs.close
		Call Alert ("恭喜,QQ登录成功，初始密码123456，请尽快修改.","/UserCenter.asp?gaozhen=myinfo")
	Set oRs = Nothing
	End If
%>