<%
'################################################################
'	文件名称：checkvalid.asp
'	作    用：检测管理员是否登陆
'	函    数：FRAdminLevel()
'	返 回 值：True or False
'	最后更新：Fine Sincere (Mr.Hou)
'	最后日期：2007-5-7
'################################################################
'if Not ChkPost then 
'CloseConn
'response.redirect ("admin_login.asp")
'response.end
'end if
if Request.Cookies("admin_name")="" then
CloseConn
Response.Write ("<script language=JavaScript>{top.location.href='"&SiteUrl&InstallDir&AdminDir&"/admin_login.asp';}</script>")
response.end
end if
admin_name=CheckStr(Request.Cookies("admin_name"))
Set Rs=Server.Createobject("Adodb.RecordSet")
sql="select * from JOB_admin where JOB_user='"&admin_name&"'"
Rs.open sql,conn,1,1
if rs.eof then
  rs.close
  set rs=nothing
  CloseConn
  Response.Write ("<script language=JavaScript>{top.location.href='"&SiteUrl&InstallDir&AdminDir&"/admin_login.asp';}</script>")
  response.end
else
	if Request.Cookies("admin_pass")<>rs("JOB_pass") then
	  rs.close
	  set rs=nothing
	  CloseConn
	  Response.Write ("<script language=JavaScript>{top.location.href='"&SiteUrl&InstallDir&AdminDir&"/admin_login.asp';}</script>")
	  response.end
	else
	  Response.Cookies("admin_flag")=rs("JOB_flag")
	  Response.Cookies("admin_type")=rs("job_type")
	end if
end if

Function FRAdminLevel(sValue)    '2007年5月6日修改为FRAdminLevel  V6.0通用管理权限函数名称
	FRAdminLevel=False
	If sValue<>"" Then
		If Instr(","&Request.Cookies("admin_flag")&",",","&sValue&",")>0 Or Request.Cookies("admin_type")="manage" Then
			FRAdminLevel=True
		Else
			FRAdminLevel=False
		End If
	End If
End Function
Sub ErrorMsg()
	Response.Write "<script>alert('禁止非法登陆，请返回！');window.opener=null;window.close();</script>"
	Response.End
End Sub

if Request.Cookies("admin_style")<>"" then
sk=Request.Cookies("admin_style")
end if
%>