<%
Class Check
	Private ErrMsg
	Private SucMsg
	Public CacheName
	Public i
	Public CheckAdmin
	Public CheckAdminAll
	Public Administer
	Public tempAdmin
	Public tadmin
	Public Flag
	Public Purview
	Public AdminName

	Private Sub Class_Initialize()
		On Error Resume Next
		CacheName = Replace(Replace(Replace(Replace(LCase(Server.MapPath("index.asp")), "index.asp", ""), ":", ""), "\", ""), "admin", "")
	End Sub

	Public Property Get AdminChk()
		AdminChk = Administer
	End Property

	Public Property Let AdminChk(iIndex)
		Administer = iIndex
	End Property

	Public Sub Check()
		If Session(CacheName & "AdminName") = "" Then
			Session(CacheName & "AdminName") = Request.Cookies("DownsysClass_net")("AdminName")
			Session(CacheName & "Flag") = Request.Cookies("DownsysClass_net")("Flag")
			Session(CacheName & "Purview") = Request.Cookies("DownsysClass_net")("Purview")
			Session(CacheName & "adminid") = Request.Cookies("DownsysClass_net")("adminid")
		End If
		AdminName = Session(CacheName & "AdminName") '管理员名称
		Flag = Session(CacheName & "Flag") '管理员级别
		Purview = Session(CacheName & "Purview") '管理权限
		If AdminName = "" Then
			ErrMsg = ErrMsg + "<BR>" + "<li>您没有进入本页面的权限!本次操作已被记录!<li>可能您还没有登陆或者不具有使用当前功能的权限!请联系管理员.<li>本页面为[<font color=red>管理员</font>]专用,请先<a href=login.asp class=meun target=_top>登陆</a>后进入."
			Response.redirect ("showerr.asp?action=error&Message=" & Server.URLEncode(ErrMsg) & "")
			Response.End
		End If
		If Flag = 1 Then
			CheckAdmin = "do"
			CheckAdminAll = "do"
		ElseIf Flag = 0 Then
			If Administer <> "" Then
				If Purview <> "" Then
					tempAdmin = Split(Purview, ",")
					For i = 0 To UBound(tempAdmin)
						If Trim(tempAdmin(i)) = Trim(Administer) Then
							CheckAdmin = "do"
							Exit For
						End If
					Next
				End If
			Else
				CheckAdmin = "do"
			End If
		Else
			ErrMsg = "<li>您没有进入本页面的权限!本次操作已被记录!</li><BR><BR><li>本页面为[<font color=red>管理员</font>]等级以上用户专用,请先<a href=login.asp class=meun target=_top>登陆</a>后进入.</li>"
			Response.redirect ("showerr.asp?action=error&Message=" & Server.URLEncode(ErrMsg) & "")
			Response.End
		End If

		If CheckAdmin <> "do" Then
			ErrMsg = "<li>确认身份失败!可能您还没有登陆或者不具有使用当前功能的权限!"
			Response.redirect ("showerr.asp?action=error&Message=" & Server.URLEncode(ErrMsg) & "")
			Response.End
		End If
	End Sub

	Public Function ChkAdmin(tadmin, Administer)
		ChkAdmin = False
		If Flag = 1 Then
			ChkAdmin = True
		Else
			If Administer <> "" Then
				tempAdmin = Split(Administer, ",")
				For i = 0 To UBound(tempAdmin)
					If Trim(tempAdmin(i)) = Trim(tadmin) Then
						ChkAdmin = True
						Exit For
					End If
				Next
			End If
		End If
	End Function

	Public Sub Error_Msg(ErrMsg)
		Response.Write "<html><head><title>错误提示信息!</title><meta http-equiv=Content-Type content=text/html; charset=gb2312>" & vbCrLf
		Response.Write "<link href=style.css rel=stylesheet type=text/css></head><body><br><br>" & vbCrLf
		Response.Write "<BR><table cellpadding=5 cellspacing=1 border=0 width=75% align=center class=tableBorder1>" & vbCrLf
		Response.Write "  <tr><th>错误提示信息!</th></tr>" & vbCrLf
		Response.Write "  <tr><td width=100% height=45 class=forumRow><b>　　产生错误的可能原因：</b><BR>" & ErrMsg & "</td></tr>" & vbCrLf
		Response.Write "  <tr><td align=center height=25 class=forumRowHighlight><a href=javascript:history.go(-1)>返回上一页...</a></td></tr>" & vbCrLf
		Response.Write "</table><BR>" & vbCrLf
		Response.Write "</body></html>" & vbCrLf
	End Sub
	'********成功提示信息****************
	Public Sub Succeed_Msg(SucMsg)
		Response.Write "<BR><table width=""75%"" align=""center"" border=""0"" cellpadding=""5"" cellspacing=""1"" class=""tableBorder1"">" & vbCrLf
		Response.Write "    <tr> " & vbCrLf
		Response.Write "      <th>成功提示信息!</th>" & vbCrLf
		Response.Write "    </tr>" & vbCrLf
		Response.Write "  <tr><td width=100% height=45 class=forumRow>" & SucMsg & "</td></tr>" & vbCrLf
		Response.Write "  <tr><td align=center height=25 class=forumRowHighlight><a href='" & Request.ServerVariables("HTTP_REFERER") & "'>返回上一页...</a></td></tr>" & vbCrLf
		Response.Write " </table><BR>" & vbCrLf
	End Sub
	Public Sub AdminCookiesToSession()
		If Session("AdminName") = "" Then
			Session(CacheName & "AdminName") = Request.Cookies("DownsysClass_net")("AdminName")
			Session(CacheName & "Flag") = Request.Cookies("DownsysClass_net")("Flag")
			Session(CacheName & "Purview") = Request.Cookies("DownsysClass_net")("Purview")
			Session(CacheName & "adminid") = Request.Cookies("DownsysClass_net")("adminid")
		End If
	End Sub
End Class
%>
