<!--#include file="../../conn.asp"-->
<!--#include file="../../inc/class_sys.asp"-->
<!--#include file="../../inc/md5.asp"-->
<%
dim oblog,rstRole
set oblog=new class_sys
oblog.start
chk_sysadmin
'页面级Role
If Session("roleid")<>"" Then
	Set rstRole=oblog.Execute("Select * From oblog_roles Where roleid=" & Cint(Session("roleid")))
End If
dim m_name
dim Action,FoundErr,ErrMSg,sGuide
G_P_PerMax=20
sub chk_sysadmin()
	dim m_password,sql,rs	
	If Session("adminname")<>"" Then
		m_name=oblog.filt_badstr(session("adminname"))
		m_password=oblog.filt_badstr(session("adminpassword"))
	Else
		m_name=oblog.filt_badstr(session("m_name"))
		m_password=oblog.filt_badstr(session("m_pwd"))
	End If
	if m_name="" then
		response.redirect "m_login.asp"
		exit sub
	end if
	sql="select id from oblog_admin where username='" & m_name & "' and password='"&m_password&"'"
	If Not IsObject(conn) Then link_database
	set rs=conn.execute(sql)
	if rs.eof then
		set rs=nothing
		response.redirect "m_login.asp"
		exit sub		
	end if
	rs.close
	set rs=nothing	
		
end sub
Function CheckSafePath(byval strMode)
	Dim strPathFrom,strPathSelf,arrFrom,arrSelf,i
	CheckSafePath=False
	If oBlog.ChkPost=False Then Exit Function
	strPathFrom = Replace(LCase(CStr(request.ServerVariables("HTTP_REFERER"))),"http://","")
    strPathSelf = Replace(LCase(CStr(request.ServerVariables("URL"))),"http://","")
    If strPathFrom="" Then Exit Function
    If strPathSelf="" Then Exit Function
    arrFrom=Split(strPathFrom,"/")
    arrSelf=Split(strPathSelf,"/")
    For i=0 To UBound(arrFrom)
    	'Response.Write "arrFrom("&i&")="& arrFrom(i) & "<BR/>"
	Next
	For i=0 To UBound(arrSelf)
    	'Response.Write "arrSelf("&i&")="& arrSelf(i) & "<BR/>"
	Next
    Select Case strMode
    	Case "0"
			 For i = 1 To (UBound(arrSelf)-1)
				 If arrFrom(i)=arrSelf(i) And Left(arrFrom(UBound(arrfrom)),Len(arrSelf(UBound(arrself))))=arrSelf(UBound(arrself))Then CheckSafePath=True
			 Next
			 'If arrFrom(1)=arrSelf(1) And Left(arrFrom(2),Len(arrSelf(2)))=arrSelf(2)Then CheckSafePath=True
			 'Response.Write checkSafePath
	End Select
End Function

sub WriteErrMsg()
	dim strErr
	strErr=strErr & "<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbcrlf
	strErr=strErr & "<link href='style.css' rel='stylesheet' type='text/css'></head><body><br><br>" & vbcrlf
	strErr=strErr & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbcrlf
	strErr=strErr & "  <tr align='center' class='title'><td height='22'><strong>错误信息</strong></td></tr>" & vbcrlf
	strErr=strErr & "  <tr class='tdbg'><td height='100' valign='top'><b>产生错误的可能原因：</b>" & errmsg &"</td></tr>" & vbcrlf
	strErr=strErr & "  <tr align='center' class='tdbg'><td><a href='javascript:history.go(-1)'>&lt;&lt; 返回上一页</a></td></tr>" & vbcrlf
	strErr=strErr & "</table>" & vbcrlf
	strErr=strErr & "</body></html>" & vbcrlf
	response.write strErr
end sub

'权限校验
Function CheckAccess(field)
On Error Resume Next
	CheckAccess=false
	If Session("roleid")="0" Then
'		If Session("adminname")<>"" Then
			CheckAccess=true
			Exit Function
'		End If
	Else
		If Session("roleid")<>"" Then
			If Not rstRole.Eof Then
				If rstRole(field)=1 Then
					CheckAccess=true
					Exit Function
				End If
			End If
		End If
	End If
	CheckAccess=false
End Function


%>
<script language="javascript">
function CheckSel(Voption,Value)
{
	var obj = document.getElementById(Voption);
	for (i=0;i<obj.length;i++){
		if (obj.options[i].value==Value){
		obj.options[i].selected=true;
		break;
		}
	}
}
function CheckAll(form)
{
  var v = form.chkAll.checked;
  for (var i=0;i < form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkOne")
       e.checked = v;
    }	
}
function chang_size(num,objname)
{
	var obj=document.getElementById(objname)
	if (parseInt(obj.rows)+num>=3) {
		obj.rows = parseInt(obj.rows) + num;	
	}
	if (num>0)
	{
		obj.width="90%";
	}
}
</script>
<style type="text/css">
#showpage{
	CLEAR: both;
	text-align: center;
	width: 100%;
}
</style>