<%
Dim UserPoints
UserPoints = NewAsp.CheckNumeric(NewAsp.UserPoint)

Function CheckUserIsLogin()
	Dim Rs
	CheckUserIsLogin = False
	Set Rs = NewAsp.Execute("SELECT userid,Username,Password,Points,Randomcode FROM NC_Ask_Users WHERE userid="& NewAsp.UserID &" And Userlock=0")
	If Rs.BOF And Rs.EOF Then
		Set Rs = Nothing
		Response.Write "<script>alert('亲爱的用户:\n\n您还没有登录,请先登录!');</script>"
		NewAsp.FoundErr = True
		Exit Function
	Else
		If Rs(1) <> NewAsp.UserName Or Rs(2) <> NewAsp.PassWord Then
			Response.Write "<script>alert('亲爱的用户:\n\n您的用户名或密码不正确,请重新登录!');</script>"
			NewAsp.FoundErr = True
			Exit Function
		Else
			NewAsp.UserID = Rs(0)
			NewAsp.UserName = Rs(1)
			NewAsp.PassWord = Rs(2)
			UserPoints = Rs(3)
		End If
	End If
	Set Rs = Nothing
	CheckUserIsLogin = True
End Function

Function ChkArrayID(str)
	If str<>"" And str<>"0" Then
		Dim strArray,i,n,m_strID,CHECK_ID
		strArray=Split(str, ",")
		n=0
		For i=0 To UBound(strArray)
			CHECK_ID = Trim(strArray(i))
			If CHECK_ID<>"" And IsNumeric(CHECK_ID) And CHECK_ID<>"0" Then
				n=n+1
				If n=1 Then
					m_strID = CHECK_ID
				Else
					m_strID = m_strID&","&CHECK_ID
				End If
			End If
		Next
		ChkArrayID=m_strID
	Else
		ChkArrayID=""
	End If
End Function

If NewAsp.UserID = 0 Then
	NewAsp.FoundErr = True
	Response.Write "<script>alert('亲爱的用户:\n\n您还没有登录,请先登录!');top.location='login.asp?ReturnURL=' + top.document.referrer + '';</script>"
	Response.End
End If

If NewAsp.Asked_Setting(22) = "1" Then
	If NewAsp.UserSession.documentElement.selectSingleNode("userinfo/@randomcode").text <> NewAsp.Randomcode Then
		Response.Cookies(NewAsp.Asked_sn) = Empty
		Response.Write "<script>alert('亲爱的用户:\n\n你已经在其他地方登录，本系统不允许两个人使用同一个帐号登录!');top.location='login.asp?ReturnURL=' + top.document.referrer + '';</script>"
		Response.End
	End If
End If

%>