📄 mayvote_function.asp
字号:
<%
'**************************************************
'函数名: isinteger
'作用:检查ID是否为整数型
'参数: para------ID段
'返回值:TRUE/FALSE
'**************************************************
function isInteger(para)
on error resume next
dim str
dim l,i
if isNUll(para) then
isInteger=false
exit function
end if
str=cstr(para)
if trim(str)="" then
isInteger=false
exit function
end if
l=len(str)
for i=1 to l
if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
isInteger=false
exit function
end if
next
isInteger=true
if err.number<>0 then err.clear
end function
'**************************************************
'函数名: MayHTMLEncode
'作用:替换
'参数: MayString----内容
'返回值:替换后的内容
'**************************************************
function MayHTMLEncode(MayString)
if isnull(MayString) or trim(MayString)="" then
MayHTMLEncode=""
exit function
end if
MayString = replace(MayString, ">", ">")
MayString = replace(MayString, "<", "<")
MayString = Replace(MayString, CHR(32), " ")
MayString = Replace(MayString, CHR(9), " ")
MayString = Replace(MayString, CHR(34), """)
MayString = Replace(MayString, CHR(39), "'")
MayString = Replace(MayString, CHR(13), "")
MayString = Replace(MayString, CHR(10) & CHR(10), "</P><P> ")
MayString = Replace(MayString, CHR(10), "<BR> ")
MayHTMLEncode = MayString
end function
'**************************************************
'函数名:strLength
'作 用:求字符串长度。汉字算两个字符,英文算一个字符。
'参 数:str ----要求长度的字符串
'返回值:字符串长度
'**************************************************
Function strLength(str)
On Error Resume Next
Dim WINNT_CHINESE
WINNT_CHINESE = (Len("中国") = 2)
If WINNT_CHINESE Then
Dim l, t, c
Dim i
l = Len(str)
t = l
For i = 1 To l
c = Asc(Mid(str, i, 1))
If c < 0 Then c = c + 65536
If c > 255 Then
t = t + 1
End If
Next
strLength = t
Else
strLength = Len(str)
End If
If Err.Number <> 0 Then Err.Clear
End Function
'**************************************************
'函数名:ReplaceBadChar
'作 用:过滤非法的SQL字符
'参 数:strChar-----要过滤的字符
'返回值:过滤后的字符
'**************************************************
Function ReplaceBadChar(strChar)
If strChar = "" Or IsNull(strChar) Then
ReplaceBadChar = ""
Exit Function
End If
Dim strBadChar, arrBadChar, tempChar, i
strBadChar = "',%,^,&,?,(,),<,>,[,],{,},/,\,;,:," & Chr(34) & "," & Chr(0) & ""
arrBadChar = Split(strBadChar, ",")
tempChar = strChar
For i = 0 To UBound(arrBadChar)
tempChar = Replace(tempChar, arrBadChar(i), "")
Next
ReplaceBadChar = tempChar
End Function
Function PE_CLng(ByVal str1)
If IsNumeric(str1) Then
PE_CLng = CLng(str1)
Else
PE_CLng = 0
End If
End Function
Function PE_CDbl(ByVal str1)
If IsNumeric(str1) Then
PE_CDbl = CDbl(str1)
Else
PE_CDbl = 0
End If
End Function
'------------------检查某一目录是否存在-------------------
Function CheckDir(FolderPath)
folderpath=Server.MapPath(".")&"\"&folderpath
Set fso1 = CreateObject("Scripting.FileSystemObject")
If fso1.FolderExists(FolderPath) then
'存在
CheckDir = True
Else
'不存在
CheckDir = False
End if
Set fso1 = nothing
End Function
'-------------根据指定名称生成目录-----------------------
Function MakeNewsDir(foldername)
dim f
Set fso1 = CreateObject("Scripting.FileSystemObject")
Set f = fso1.CreateFolder(foldername)
MakeNewsDir = True
Set fso1 = nothing
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -