'论坛公用函数
Public Function CodeCookie(Str)
If set_cookies = 1 Then
Dim i
Dim StrRtn
For i = Len(Str) To 1 Step -1
StrRtn = StrRtn & AscW(Mid(Str, i, 1))
If (i 1) Then StrRtn = StrRtn & "a"
Next
CodeCookie = StrRtn
Else
CodeCookie = Str
End If
End Function
Public Function DecodeCookie(Str)
If set_cookies = 1 Then
Dim i
Dim StrArr, StrRtn
StrArr = Split(Str, "a")
For i = 0 To UBound(StrArr)
If IsNumeric(StrArr(i)) = True Then
StrRtn = ChrW(StrArr(i)) & StrRtn
Else
StrRtn = Str
Exit Function
End If
Next
DecodeCookie = StrRtn
Else
DecodeCookie = Str
End If
End Function
'输出字符串并换行
Function Echo(Str)
Response.Write Str & VbCrlf
End Function
'分页判断
Function CheckNum(ByVal strStr,ByVal blnMin,ByVal blnMax,ByVal intMin,ByVal intMax)
Dim i,s,iMi,iMa
s=Left(Trim(""&strStr),32):iMi=intMin:iMa=intMax
If IsNumeric(s) Then
i=CDbl(s)
i=IIf(blnMin=1 And i i=IIf(blnMax=1 And i>iMa,iMa,i)
Else
i=iMi
End If
CheckNum=i
End Function
'**************************************************
'函 数 名:CID
'作 用:转换为有效的 ID
'返回值类型:Integer (>=0)
'**************************************************
Function CID(strS)
Dim intI
intI = 0
If IsNull(strS) Or strS = "" Then
intI = 0
Else
If Not IsNumeric(strS) Then
intI = 0
Else
Dim intk
On Error Resume Next
intk = Abs(Clng(strS))
If Err.Number = 6 Then intk = 0 ''数据溢出
Err.Clear
intI = intk
End If
End If
CID = intI
End Function
'**************************************************
'函 数 名:HRF
'作 用:转换为有效的 Request参数并过虑
'返回值类型:过虑后的字符
'**************************************************
Function HRF(a,b,c)
Dim Str
Select Case a
Case 1
Str = Request.Form(c)
Case 2
Str = Request.QueryString(c)
Case 3
Str = Request.Cookies(c)
Case Else
Str = Request(c)
End Select
Select Case b
Case 1
Str = HtmlEncode(str)
Case 2
Str = CID(str)
End Select
HRF = Str
End Function
'判断用户名
Function IstrueName(uName)
Dim Hname,i
IstrueName = False
Hname = Array("=","%",chr(32),"?","&",";",",","'",",",chr(34),chr(9),"