'返回: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