<%
Rem 获取调用地址
Function GetUrl()
	Dim strTemp
	If LCase(request.ServerVariables("HTTPS")) = "off" Then
		strTemp = "http://"
	Else
        strTemp = "https://"
    End If
	strTemp = strTemp & request.ServerVariables("SERVER_NAME")
	If request.ServerVariables("SERVER_PORT") <> 80 Then 
		strTemp = strTemp & ":" & request.ServerVariables("SERVER_PORT")
	end if
    strTemp = strTemp & request.ServerVariables("URL")
    If Trim(request.QueryString) <> "" Then 
		strTemp = strTemp & "?" & Trim(request.QueryString)
	end if
    GetUrl = strTemp
End Function
%>
<%
Rem 检测非法字符
function ChkBadWord(fString)
	result=0
	if not isnull(fString) then
		result=result+Instr(fString,"&")
		result=result+Instr(fString,">")
		result=result+Instr(fString,"<")
		result=result+Instr(fString," and ")
		result=result+Instr(fString," or ")

		result=result+Instr(fString,CHR(34))
		result=result+Instr(fString,CHR(39))

		ChkBadWord=result
	else
		ChkBadWord=result
	end if
end function
%>

<%
Rem 新闻页面输入参数检测
sub filter_news()
	errstr=""
	id=trim(request("id"))
	if(ChkBadWord(id)<>0) then
		errstr="输入参数包含非法字符"
	end if
	
	if(errstr<>"") then
		session("message")=errstr
		response.Redirect("error.asp")
	end if
end sub
%>