#T= 检测上页是否从本站提交
<%
''检测上页是否从本站提交
''返回:True,False
''===============================================================
Function IsSelfRefer()
Dim sHttp_Referer, sServer_Name
sHttp_Referer = CStr(Request.ServerVariables("HTTP_REFERER"))
sServer_Name = CStr(Request.ServerVariables("SERVER_NAME"))
IF(Mid(sHttp_Referer, 8, Len(sServer_Name)) = sServer_Name)THEN
IsSelfRefer = True
ELSE
IsSelfRefer = False
END IF
End Function
%>
#T= 清除所有HTML标记
<%
''清除HTML标记
Function stripHTML(htmlStr)
Dim regEx
SET regEx = New Regexp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "<.+?>"
htmlStr = regEx.Replace(htmlStr,"")
htmlStr = Replace(htmlStr, "<","<")
htmlStr = Replace(htmlStr, ">",">")
htmlStr = Replace(htmlStr,chr(10),"")
htmlStr = Replace(htmlStr,chr(13),"")
stripHTML = htmlStr
SET regEx = Nothing
End Function
%>
#T= 取字符串长度
<%
''求字符串长度函数
Function GetLength(str)
Dim Length
For i=1 to Len(str)
IF(Asc(Mid(str,i,1))<0 or Asc(Mid(str,i,1))>256)THEN
Length=Length+2
ELSE
Length=Length+1
END IF
Next
GetLength=Length
End Function
%>
#T= 截取指定长度字符串
<%
''截取指定长度的字符串,多余的用...代替
Function StrLeft(str,strlen)
IF(str = "")THEN
StrLeft = ""
Exit Function
END IF
Dim l,t,c,i
str = Replace(Replace(Replace(Replace(str," "," "),""",chr(34)),">",">"),"<","<")
l=len(str)
t=0
For i=1 to l
c=Abs(Asc(Mid(str,i,1)))
IF(c>255)THEN
t=t+2
ELSE
t=t+1
END IF
IF(t>strlen)THEN
StrLeft = left(str,i) & "..."
Exit For
ELSE
StrLeft = str
END IF
Next
StrLeft = Replace(Replace(Replace(Replace(StrLeft," "," "),chr(34),"""),">",">"),"<","<")
End Function
%>
#T= 获取安全的提交参数
<%
''===============================================================
''SQL Injection Check
''函数功能:过滤字符参数中的单引号,对于数字参数进行判断,如果不是数值类型,则赋值0
''参数意义:str ---- 要过滤的参数
''strType ---- 参数类型,分为字符型和数字型,字符型为"s",数字型为"i"
''===============================================================
Function CheckStr(str,strType)
Dim strTmp
strTmp = ""
IF(strType ="s")THEN
strTmp = Replace