手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网络编程>Asp编程>列表

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

来源:互联网 作者:west263.com 时间:2008-02-23
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

End If
rsDivPage.AbsolutePage=p_intCurPage
End If
If Err Then
Err.Clear
rsDivPage.Close
Set rsDivPage=Nothing
If SaveLog Then
tmpMsg="连接数据库错误,请检查您的查询代码是否正确。<br>基于安全的理由,只显示本信息,要查看详细的错误信息,请设置dsj.Debug=True"
Response.Write SaveSQLLog(cmd,tmpMsg)
Else
Response.Write "连接数据库错误,请检查您的查询代码是否正确。"
End If
Response.End()
End If
SQLQueryNum=SQLQueryNum 1
Set GetRs=rsDivPage
End If
End Property

Public Property Let GetSQL(str_sql)
If str_sql<>"" Then
p_GetSQL=str_sql
Else
AddErrorCode(111)
If Debug Then ShowErrMsg()
p_GetSQL="The Property of GetSQL is NULL."
End If
End Property
Public Property Get GetSQl()
GetSQL=p_GetSQL
End Property


'******************************
'名称: gotTopic
'参数:str,strlen
'返回值:被限制后的字符串
'创建时间:2005年3月3日
'作用:限制被限制的字符串
'******************************
Public Function GotToPic(str,strlen)
Rem 限制字符串显示长度在一定的范围内
Dim i,StringLen,CharSize,EchoCharType
StringLen=len(str)
CharSize=0
For i=1 to StringLen
EchoCharType=Abs(Asc(Mid(str,i,1)))
If EchoCharType>255 Then
CharSize=CharSize 2
Else
CharSize=CharSize 1
End If
If CharSize>strlen Then
gotTopic=Left(str,i) & "..."
Exit For
Else
gotTopic=str & ""
End If
Next
End Function

'******************************
'名称: 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

'******************************
'名称: ClientConnected
'参数:NULL
'返回值:NULL
'创建时间:2005年5月5日
'作用:得到用户是否与服务器连接
'******************************
Public Sub ClientConnected()
If Response.IsClientConnected then
Response.Flush()
Else
Response.End()
End If
End Sub

'******************************
'名称: ChkPost
'参数:NULL
'返回值:True/False
'创建时间:2005年5月5日
'作用:检查被提交的数据来源

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!