一个比较实用的asp函数集合类(2)

大西北小胖

大西北小胖

2016-01-29 19:43

一个比较实用的asp函数集合类(2),一个比较实用的asp函数集合类(2)
       '******************************
   '名称: ChkInvStr
   '参数:Str
   '返回值:True/False
   '创建时间:2005年5月2日
   '作用:检查参数是否有非法字符
   '******************************
   Public Function ChkInvStr(Str)
   Rem 定义需要过滤得非法字符
   Dim InvaildWord,inWords,i
   Str=CStr(Str)
   ChkInvStr=False
   If Len(Replace(p_InvaildWords,Chr(0),""))<1 Then
   AddErrorCode(103) 'invaildwords is null
   Exit Function
   Else
   If Instr(1,p_Invaildwords,"")>0 Then
   InvaildWord=Split(p_InvaildWords,"")
   inWords=LCase(Trim(Str))
   For i=LBound(InvaildWord) To UBound(InvaildWord)
   If Instr(inWords,InvaildWord(i))>0 Then
   p_Error=1982
   AddErrorCode(105)
   ChkInvStr=True
   Exit Function
   End If
   Next
   Else
   AddErrorCode(104) '"" is requried.
   Exit Function
   End If
   End If
   End Function
  
   '******************************
   '名称: GetIP
   '参数:NULL
   '返回值:NULL
   '创建时间:2005年5月3日
   '作用:得到用户的ip地址
   '******************************
   Public Function GetIP()
   p_IpAdd=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
   If IsNull(p_IpAdd) OR p_IpAdd="" Then
   p_IpAdd=Request.ServerVariables("REMOTE_ADDR")
   End If
   GetIp=p_IpAdd
   End Function
  
   '******************************
   '名称: IPAddress
   '参数:sip
   '返回值:County,City
   '作用:对数据内容进行排版转换
   '创建时间:2005年5月6日
   '来源:www.knowsky.com
   '******************************
   Public Function IPAddress(sip)
   Dim IPConnStr,IPConn,IPAddressDB
   Dim str1,str2,str3,str4
   Dim num
   Dim country,city,address
   Dim IPRs,SQL
   address="未知"
   If IsNumeric(Left(sip,2)) Then
   If sip="127.0.0.1" Then sip="192.168.0.1"
   str1=Left(sip,InStr(sip,".")-1)
   sip=mid(sip,instr(sip,".")+1)
   str2=Left(sip,instr(sip,".")-1)
   sip=Mid(sip,InStr(sip,".")+1)
   str3=Left(sip,instr(sip,".")-1)
   str4=Mid(sip,instr(sip,".")+1)
   If isNumeric(str1)=0 or isNumeric(str2)=0 or isNumeric(str3)=0 or isNumeric(str4)=0 Then
   Else
   num=CLng(str1)*16777216+CLng(str2)*65536+CLng(str3)*256+CLng(str4)-1
   IPAddressDB = "DSJ_Ipaddress.mdb"
   IPConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(p_dbFolder & IPAddressDB)
   Set IPConn = Server.CreateObject("ADODB.Connection")
   IPConn.Open IpConnStr
   country="亚洲"
   city=""
   sql="select top 1 country,city from DSJ_IPAddress where ip1 <="&num&" and ip2 >="&num&""
   Set IPRs=IPConn.execute(sql)
   If Not(IPRs.EOF And IPRs.bof) Then
   country=IPRs(0)
   city=IPRs(1)
   End If
   IpRs.Close:Set IPRs=Nothing
   IPConn.CLose:Set IPConn = Nothing
   SqlQueryNum = SqlQueryNum+1
   End If
   IPAddress=country&city
   End If
   End Function
展开更多 50%)
分享

猜你喜欢

一个比较实用的asp函数集合类(2)

ASP
一个比较实用的asp函数集合类(2)

一个比较实用的asp函数集合类

ASP
一个比较实用的asp函数集合类

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

一个比较实用的asp函数集合类(1)

ASP
一个比较实用的asp函数集合类(1)

如何编写一个ASP类

Web开发
如何编写一个ASP类

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

asp中的一个奇怪的函数

ASP
asp中的一个奇怪的函数

创建一个ASP通用分页类(一)

ASP
创建一个ASP通用分页类(一)

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

RPM 的使用

RPM 的使用

用ASP构建音乐服务器

用ASP构建音乐服务器
下拉加载更多内容 ↓