<%
Sub CheckLogin()
	Dim Rs
	Dim PerId,UserName,PassWord,UserType
	PerId = Session("PerId")
	UserName = Session("UserName")
	PassWord = Session("PassWord")
	UserType = Session("UserType")
	
	If PerId = "" Or IsNull(PerId) Or UserName = "" Or IsNull(UserName) Or PassWord = "" Or IsNull(PassWord) Or UserType <> "Person" Then
		ToLogin()
		Exit Sub
	End If
	
	Set Rs = Conn.Execute("select * from PersonTbl where PerId = "& PerId &" and UserName = '"& UserName &"'")
	If Rs.Eof Then
		ToLogin()
		Exit Sub
	Else
		If Cstr(Rs("PassWord")) <> Cstr(PassWord) Then
			ToLogin()
			Exit Sub
		End If
	End If
	Set Rs = Nothing
End Sub

Sub ToLogin()
	Response.Write("<script language=""javascript"">top.location.href='../Login.asp';</script>")
	Response.End()
End Sub

CheckLogin()
%>