function.asp

来自「这是一本关于高级软件工程的书籍」· ASP 代码 · 共 36 行

ASP
36
字号
<%
	function managestr(str)
	on error resume next
	''''''''''''''''''''''''''''
	'处理输入字串、过滤输入变量'
	'                          '
	''''''''''''''''''''''''''''
	
		dim keyarray,i,tmp,tmp1
		tmp1 = trim(cstr(str))
		if tmp1<>"" then
			keyarray = Array("javascript","<",">",";","return","script","&lt","&gt"," ","'","%")
			if instr(1,tmp1,"insert ")>0 and instr(1,tmp1," from ")>0 and instr(1,tmp1,";")>0 then
				tmp="xxxxxxxxxx"
			end if
		
			if instr(1,tmp1,"delete ")>0 and instr(1,tmp1," from ")>0 and instr(1,tmp1,";")>0 then
				tmp="xxxxxxxxxx"
			end if
		
			if instr(1,tmp1,"update ")>0 and instr(1,tmp1," from ")>0 and instr(1,tmp1,";")>0 then
				tmp="xxxxxxxxxx"
			end if
	
			if instr(1,tmp1,"function ")>0 and instr(1,tmp1,"{")>0 and instr(1,tmp1,"}")>0 then
				tmp="xxxxxxxxxx"
			end if
	
			for i=0 to ubound(keyarray)
				if instr(1,tmp1,keyarray(i))>0 then tmp = replace(tmp1,keyarray(i),"")
			next
			tmp = replace(tmp1,"'","''")
		end if
		managestr = tmp
	end function  
%>

⌨️ 快捷键说明

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