⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 func.asp

📁 自动化网络办公系统全部源码officeanywheresystem
💻 ASP
字号:

<%
'DataFilter函数对数据进行过滤,Secret是选择加密算法,Return 是当Str为空时的返回值.
function DataFilter(ByVal Str,Secret,Return)
	Dim i
	Dim key1(7), key3(7), Keystep
	Dim newstr
	newstr = ""
	Dim key2
	read=str
	if Str="" then
		DataFilter=""
	elseif Secret=11 then
		'解密算法1
		if len(return)=19 then
			for i=1 to 6 
				key1(i)=asc(mid(return,i,1))
			next
			newstr=mid(return,1,6)
			for i=1 to int(13/len(read))+1
				oldstr=oldstr&read
			next
			key2=asc(mid(read,2,1))
			For i = 1 To Len(read)
					key2 = (Asc(Mid(read, i, 1)) * key2) Mod 93 +33
			Next
			key3(1) = (key1(1) * key2) Mod 93 + 33
			For i = 2 To 6
					key3(i) = (key1(i) * key3(i - 1)) Mod 93 + 33
			Next
			For i = 1 To 13
					index=key3(index) Mod 6+1
					newchar=Chr((key3(index) * asc(Mid(oldstr ,i, 1))) Mod 80 +33+i)
					newstr = newstr & Chr((key3(index) * asc(Mid(oldstr ,i, 1))) Mod 80 + 33+i)
			Next
		else
			newstr=""
		end if
		DataFilter=newstr
	elseif Secret=1 then
		upperbound=126
		lowerbound=33
		read=str
		Randomize
		For i = 1 To 6
				key1(i) = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
				newstr = newstr & Chr(key1(i))
		Next
		for i=1 to int(13/len(read))+1
			oldstr=oldstr&read
		next
		key2=asc(mid(read,2,1))
		For i = 1 To Len(read)
				key2 = (Asc(Mid(read, i, 1)) * key2) Mod 93 +33
		Next
		key3(1) = (key1(1) * key2) Mod 93 + 33
		For i = 2 To 6
				key3(i) = (key1(i) * key3(i - 1)) Mod 93 + 33
		Next
		For i = 1 To 13
				index=key3(index) Mod 6+1
				newchar=Chr((key3(index) * asc(Mid(oldstr ,i, 1))) Mod 80 +33+i)
				newstr = newstr & Chr((key3(index) * asc(Mid(oldstr ,i, 1))) Mod 80 + 33+i)
		Next
		'加密算法1
		DataFilter=newstr
	else
		'返回明文
		DataFilter=str
	End if
End Function

function name2ID(str_name)
    set m_oRS=server.createObject("adodb.recordset")
	response.write "select id from userinfo where name="&str_name
	m_oRS.open "select id from userinfo where name="&str_name,oCon
	if not Obj_Cursor.eof then 
		name2id=m_oRS("id")
	else
		name2id=0
	end if
	m_oRS.close
	set m_oRS=nothing
end function
'过滤文件名字符串中非法字符
function replace2filename(str_filename)
	str_filename=replace(str_filename,"/","")
	str_filename=replace(str_filename,"\","")
	str_filename=replace(str_filename,":","")
	str_filename=replace(str_filename,"*","")
	str_filename=replace(str_filename,"?","")
	str_filename=replace(str_filename,"""","")
	str_filename=replace(str_filename,"<","")
	str_filename=replace(str_filename,">","")
	str_filename=replace(str_filename,"|","")
	replace2filename=str_filename
end function
'产生后退的javascript
sub goback(backstep)
response.write "<SCRIPT LANGUAGE=""JavaScript"">"&chr(13)
response.write "<!--"&chr(13)
response.write "history.back();"&chr(13)
response.write "//-->"&chr(13)
response.write "</SCRIPT>"&chr(13)
end sub


function sbPageAuthority(sModuleID,iauthority,iUserID) 
if iuserid="" then 
	'------ time out -----
	sbPageAuthority=100
	exit function
end if
set m_oRS = server.createobject("adodb.recordset")
	iModuleid=-1
	m_oRs.open "select id from module where module_id='"&sModuleID&"'",oCon
	if not m_ors.eof then
		iModuleid=m_ors("id")
	end if
	m_ors.close
if iUserID<>1 and imoduleid<>-1 then
	m_oRs. open "select * from person_auth where module_id="&iModuleID&" and user_id="&iUserID&"",oCon
	if not m_oRs.eof then
		if m_oRs(""&iauthority&"")=1 then
		'------------- 用户有权限 -----------------
		m_oRs.close
		else 
		'------------- 用户没有权限 ----------------
		m_oRs.close
		sbPageAuthority=0
		'response.write "no auth"
		'response.end
		end if
	else 
		m_oRs.close
		'------------- 查找缺省权限组 ------------
		m_oRs.open "select department_id from userinfo where id="&iUserid&"",oCon
		if not m_oRs.eof then
			group_id=m_oRs("department_id")
			m_oRs.close
			'response.write group_id
			m_oRs.open "select auth_type_id from [group] where id="&group_id&" and disable=0",ocon
				if not m_oRs.eof then
					auth_type_id=m_oRs("auth_type_id")
					
					m_oRs.close
					'response.write "select * from default_author where module_id="&iModuleID&" and relation_id="&auth_type_id&""
					m_oRs.open "select * from default_author where module_id="&iModuleID&" and relation_id="&auth_type_id&"",oCon
					'response.write iModuleID&m_oRS.eof
					if m_oRS.eof then
						'----------- 没有找到缺省权限 ---------------
						sbPageAuthority=40
					elseif m_oRs(""&iauthority&"")=1 then
						m_oRs.close
					else
						'----------- 缺省没有权限 ---------------
						m_oRs.close
						sbPageAuthority=20
						'response.write "no auth2"
						'response.end
					end if
				else
					m_oRs.close
					sbPageAuthority=10
				end if
		
		else 
			'------------ 没有缺省权限组 ---------------
			m_oRs.close
			sbPageAuthority=30
			'response.write "no auth3"
			'response.end
		end if
	end if
else 
	if iUserID=1 then
		'-----------  admin ---------------
	else
		'-----------   无此模块  -------------
		sbPageAuthority=100
	end if
end if
end function
%>

<html><script language="JavaScript">                                                                  </script></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -