📄 ks.publiccls.asp
字号:
If IPlock Then Exit For
End If
Next
If IPlock = True Then
arrLockIPW = Split(Trim(rsLockIP(0)), "$$$")
For i = 0 To UBound(arrLockIPW)
If arrLockIPW(i) <> "" Then
arrLockIPWCut = Split(Trim(arrLockIPW(i)), "----")
IPlock = True
If CDbl(arrLockIPWCut(0)) <= sUserIP And sUserIP <= CDbl(arrLockIPWCut(1)) Then IPlock = False
If IPlock Then Exit For
End If
Next
End If
Else
If sLockType = 1 Or sLockType = 3 Then
arrLockIPW = Split(Trim(rsLockIP(0)), "$$$")
For i = 0 To UBound(arrLockIPW)
If arrLockIPW(i) <> "" Then
arrLockIPWCut = Split(Trim(arrLockIPW(i)), "----")
IPlock = True
If CDbl(arrLockIPWCut(0)) <= sUserIP And sUserIP <= CDbl(arrLockIPWCut(1)) Then IPlock = False
If IPlock Then Exit For
End If
Next
End If
If IPlock = False And (sLockType = 2 Or sLockType = 3) Then
arrLockIPB = Split(Trim(rsLockIP(1)), "$$$")
For i = 0 To UBound(arrLockIPB)
If arrLockIPB(i) <> "" Then
arrLockIPBCut = Split(Trim(arrLockIPB(i)), "----")
IPlock = True
If CDbl(arrLockIPBCut(0)) > sUserIP Or sUserIP > CDbl(arrLockIPBCut(1)) Then IPlock = False
If IPlock Then Exit For
End If
Next
End If
End If
ChecKIPlock = IPlock
End Function
Public Function Conn()
On Error Resume Next
Dim ConnObj:Set ConnObj=Server.CreateObject("ADODB.Connection")
ConnObj.Open ConnStr
Set Conn = ConnObj
End Function
'采集数据库连接
Public Function ConnItem()
Dim ConnObj:Set ConnObj=Server.CreateObject("ADODB.Connection")
ConnObj.Open CollcetConnStr
Set ConnItem = ConnObj
End Function
'***************************************************************************************************************
'函数名:GetDomain
'作 用:获取URL,包括虚拟目录
'参 数: 无
'返回值:完整域名
'***************************************************************************************************************
Public Function GetDomain()
GetDomain = Trim(Setting(2) & Setting(3))
End Function
'**************************************************
'函数名:GetChannelDomain
'作 用:获取包含频道的完整Url
'参 数:ChannelID频道ID
'返回值:完整域名
'**************************************************
Public Function GetChannelDomain(ChannelID)
GetChannelDomain=C_S(ChannelID,8)
If Left(GetChannelDomain, 1) = "/" Then GetChannelDomain = Right(GetChannelDomain, Len(GetChannelDomain) - 1)
GetChannelDomain = GetDomain() & GetChannelDomain
End Function
'**************************************************
'函数名:GetAutoDoMain()
'作 用:取得当前服务器IP 如:http://127.0.0.1
'参 数:无
'**************************************************
Public Function GetAutoDomain()
Dim TempPath
If Request.ServerVariables("SERVER_PORT") = "80" Then
GetAutoDomain = Request.ServerVariables("SERVER_NAME")
Else
GetAutoDomain = Request.ServerVariables("SERVER_NAME") & ":" & Request.ServerVariables("SERVER_PORT")
End If
If Instr(UCASE(GetAutoDomain),"/W3SVC")<>0 Then
GetAutoDomain=Left(GetAutoDomain,Instr(GetAutoDomain,"/W3SVC"))
End If
GetAutoDomain = "http://" & GetAutoDomain
End Function
Function CutFixContent(ByVal str, ByVal start, ByVal last, ByVal n)
Dim strTemp
On Error Resume Next
If InStr(str, start) > 0 Then
Select Case n
Case 0 '左右都截取(都取前面)(去处关键字)
strTemp = Right(str, Len(str) - InStr(str, start) - Len(start) + 1)
strTemp = Left(strTemp, InStr(strTemp, last) - 1)
Case Else '左右都截取(都取前面)(保留关键字)
strTemp = Right(str, Len(str) - InStr(str, start) + 1)
strTemp = Left(strTemp, InStr(strTemp, last) + Len(last) - 1)
End Select
Else
strTemp = ""
End If
CutFixContent = strTemp
End Function
'*************************************************************************
'函数名:gotTopic
'作 用:截字符串,汉字一个算两个字符,英文算一个字符
'参 数:str ----原字符串
' strlen ----截取长度
'返回值:截取后的字符串
'*************************************************************************
Public Function GotTopic(ByVal Str, ByVal strlen)
If Str = "" OR IsNull(Str) Then GotTopic = "":Exit Function
If strlen=0 Then GotTopic=Str:Exit Function
Dim l, T, c, I, strTemp
Str = Replace(Replace(Replace(Replace(Str, " ", " "), """, Chr(34)), ">", ">"), "<", "<")
l = Len(Str)
T = 0
strTemp = Str
strlen = CLng(strlen)
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
strTemp = Left(Str, I)
Exit For
End If
Next
If strTemp <> Str Then strTemp = strTemp
GotTopic = Replace(Replace(Replace(Replace(strTemp, " ", " "), Chr(34), """), ">", ">"), "<", "<")
End Function
'**************************************************
'函数名:ListTitle
'作 用:取标题
'参 数:TitleStr 标题, TitleNum 取字符数
'返回值:将标题分解成两行
'**************************************************
Public Function ListTitle(TitleStr, TitleNum)
Dim LeftStr, RightStr
ListTitle = Trim(GotTopic(Trim(TitleStr), TitleNum))
If Len(ListTitle) > CInt(TitleNum / 2) Then
LeftStr = GotTopic(ListTitle, CInt(TitleNum / 2))
RightStr = Mid(ListTitle, Len(LeftStr) + 1)
ListTitle = LeftStr & "<br>" & RightStr
End If
End Function
Function ListTitle1(TitleStr, TitleNum)
Dim ClsTitleStr, ClsTitleNum, I, J, ClsTempNum, k, ClsTitleStrResult, LeftStr, RightStr
ClsTitleNum = CInt(TitleNum)
ClsTempNum = Len(CStr(TitleStr))
If ClsTitleNum > ClsTempNum Then
ClsTitleNum = ClsTempNum
End If
ClsTitleStr = Left(CStr(TitleStr), ClsTitleNum)
Dim TempStr
For I = 1 To ClsTitleNum - 1
TempStr = TempStr & Mid(ClsTitleStr, I, 1) & "<br />"
Next
TempStr = TempStr & Right(ClsTitleStr, 1)
ListTitle1 = TempStr
End Function
'**************************************************
'函数名:GetIP
'作 用:取得正确的IP
'返回值:IP字符串
'**************************************************
Public Function GetIP()
Dim strIPAddr
If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" Or InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
strIPAddr = Request.ServerVariables("REMOTE_ADDR")
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
Else
strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
End If
getIP = Checkstr(Trim(Mid(strIPAddr, 1, 30)))
End Function
Public Function Checkstr(Str)
If Isnull(Str) Then
CheckStr = ""
Exit Function
End If
Str = Replace(Str,Chr(0),"")
CheckStr = Replace(Str,"'","''")
End Function
'================================================
'函数名:URLDecode
'作 用:URL解码
'================================================
Function URLDecode(ByVal urlcode)
Dim start,final,length,char,i,butf8,pass
Dim leftstr,rightstr,finalstr
Dim b0,b1,bx,blength,position,u,utf8
On Error Resume Next
b0 = Array(192,224,240,248,252,254)
urlcode = Replace(urlcode,"+"," ")
pass = 0
utf8 = -1
length = Len(urlcode) : start = InStr(urlcode,"%") : final = InStrRev(urlcode,"%")
If start = 0 Or length < 3 Then URLDecode = urlcode : Exit Function
leftstr = Left(urlcode,start - 1) : rightstr = Right(urlcode,length - 2 - final)
For i = start To final
char = Mid(urlcode,i,1)
If char = "%" Then
bx = URLDecode_Hex(Mid(urlcode,i + 1,2))
If bx > 31 And bx < 128 Then
i = i + 2
finalstr = finalstr & ChrW(bx)
ElseIf bx > 127 Then
i = i + 2
If utf8 < 0 Then
butf8 = 1 : blength = -1 : b1 = bx
For position = 4 To 0 Step -1
If b1 >= b0(position) And b1 < b0(position + 1) Then
blength = position
Exit For
End If
Next
If blength > -1 Then
For position = 0 To blength
b1 = URLDecode_Hex(Mid(urlcode,i + position * 3 + 2,2))
If b1 < 128 Or b1 > 191 Then butf8 = 0 : Exit For
Next
Else
butf8 = 0
End If
If butf8 = 1 And blength = 0 Then butf8 = -2
If butf8 > -1 And utf8 = -2 Then i = start - 1 : finalstr = "" : pass = 1
utf8 = butf8
End If
If pass = 0 Then
If utf8 = 1 Then
b1 = bx : u = 0 : blength = -1
For position = 4 To 0 Step -1
If b1 >= b0(position) And b1 < b0(position + 1) Then
blength = position
b1 = (b1 xOr b0(position)) * 64 ^ (position + 1)
Exit For
End If
Next
If blength > -1 Then
For position = 0 To blength
bx = URLDecode_Hex(Mid(urlcode,i + 2,2)) : i = i + 3
If bx < 128 Or bx > 191 Then u = 0 : Exit For
u = u + (bx And 63) * 64 ^ (blength - position)
Next
If u > 0 Then finalstr = finalstr & ChrW(b1 + u)
End If
Else
b1 = bx * &h100 : u = 0
bx = URLDecode_Hex(Mid(urlcode,i + 2,2))
If bx > 0 Then
u = b1 + bx
i = i + 3
Else
If Left(urlcode,1) = "%" Then
u = b1 + Asc(Mid(urlcode,i + 3,1))
i = i + 2
Else
u = b1 + Asc(Mid(urlcode,i + 1,1))
i = i + 1
End If
End If
finalstr = finalstr & Chr(u)
End If
Else
pass = 0
End If
End If
Else
finalstr = finalstr & char
End If
Next
URLDecode = leftstr & finalstr & rightstr
End Function
Function URLDecode_Hex(ByVal h)
On Error Resume Next
h = "&h" & Trim(h) : URLDecode_Hex = -1
If Len(h) <> 4 Then Exit Function
If isNumeric(h) Then URLDecode_Hex = cInt(h)
End Function
'**************************************************
'函数名:R
'作 用:过滤非法的SQL字符
'参 数:strChar-----要过滤的字符
'返回值:过滤后的字符
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -