<%
Sub CheckLogin()
	Dim Rs
	Dim ComId,UserName,PassWord,UserType
	ComId = Session("ComId")
	UserName = Session("UserName")
	PassWord = Session("PassWord")
	UserType = Session("UserType")
	
	If ComId = "" Or IsNull(ComId) Or UserName = "" Or IsNull(UserName) Or PassWord = "" Or IsNull(PassWord) Or UserType <> "Company" Then
		ToLogin()
		Exit Sub
	End If
	
	Set Rs = Conn.Execute("select * from CompanyTbl where ComId = "& ComId &" 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()
%>