分享
 
 
 

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

王朝asp·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

最近迷恋上作网站了,使用asp开发,发现asp有好多的漏洞,而且在一个网站中有好多的代码是重复使用的,所以就查询了一些资料发现在asp中可以使用类的思想,所以就写了这个类,写的不好,但是比较实用。

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<%

Const Btn_First="<font face='webdings'>9</font>" '定义第一页按钮显示样式

Const Btn_Prev="<font face='webdings'>3</font>" '定义前一页按钮显示样式

Const Btn_Next="<font face='webdings'>4</font>" '定义下一页按钮显示样式

Const Btn_Last="<font face='webdings'>:</font>" '定义最后一页按钮显示样式

Class clsDSJ

Private p_Error,p_IpAdd,p_Debug,Errs

Private p_InvaildWords

Private tmpStr

Private objConnDivPage,rsDivPage,p_GetSQL,p_nPage

Private p_rsPageSize,p_intCurPage,p_strURL,p_intTotalPage,p_intTotalRecords

Private p_dbType,p_dbFolder,p_DataBase,dbPath,p_dbUserID,p_dbPassword,p_sqlDataSource

Private param_DataBase,param_dbUserID,param_dbPassword,param_dbType

'Property

Public objConn,ConnStr,SQLQueryNum

Public logDB,WebURL

Public SaveLog

Public ErrCodes,ErrCode,ErrMsg

Public ScriptFolder,ScriptName

Private Sub Class_Initialize

p_Debug=True

ClientConnected

SaveLog=True

ErrMsg=""

p_Error=0

SQLQueryNum=0

Rem 数据库连接初始化

dbType=12 '取1x——Access,2x——SQL;x1——OLEDB,x2——ODBC

dbFolder="Data"

DataBase="zhubizidatabase.MDB"

dbUserID=""

dbPassword=""

sqlDataSource=""

p_rsPageSize=10

'p_nPage=2

If request("page")="" Then

p_intCurPage=1

ElseIf NOT IsNumeric(request("page")) Then

p_intCurPage=1

ElseIf CInt(Trim(request("page")))<1 Then

p_intCurPage=1

Else

p_intCurPage=CInt(Trim(request("page")))

End If

WebURL="http://blog.csdn.net/alonesword/"

tmpStr=Request.ServerVariables("PATH_INFO")

tmpStr=Split(tmpStr,"/",-1)

ScriptName=Lcase(tmpStr(UBound(tmpStr)))

ScriptFolder=LCase(tmpStr(UBound(tmpStr)-1)) & "/"

p_InvaildWords="select|update|delete|insert|@|--|;|'|#|%|xp|cmd|shell"

End Sub

Private Sub Class_terminate()

If IsObject(rsDivPage) Then rsDivPage.Close:Set rsDivPage=Nothing

If IsObject(objConn) Then objConn.Close:Set objConn=Nothing

End Sub

Public Property Get Version

Version="DSJ 1.1.0 Beta"

End Property

Public Property Get Error

Error=p_Error

End Property

Public Property Get Debug

Debug=p_Debug

End Property

Public Property Let Debug(BoolDebug)

If BoolDebug Then

p_Debug=True

Else

p_Debug=False

End If

End Property

Public Property Get dbType

dbType=p_dbType

End Property

Public Property Let dbType(lngdbType)

If IsNumeric(lngdbType) Then

p_dbType=lngdbType

Else

p_dbType=12

End If

End Property

Public Property Get dbFolder

dbFolder=p_dbFolder

End Property

Public Property Let dbFolder(strFolder)

If Right(strFolder,1)="\" OR Right(strFolder,1)="/" Then

p_dbFolder=strFolder

Else

If (NOT IsNull(strFolder)) OR (strFolder<>"") Then

p_dbFolder=strFolder & "\"

Else

p_dbFoler=""

End If

End If

End Property

Public Property Get Database

Database=p_dataBase

End Property

Public Property Let Database(strDataBase)

p_dataBase=strDatabase

End Property

Public Property Get dbUserID

dbUserID=p_dbUserID

End Property

Public Property Let dbUserID(strDataBaseUserID)

p_dbUserID=strDataBaseUserID

End Property

Public Property Get dbPassword

dbPassword=p_dbPassword

End Property

Public Property Let dbPassword(strDataBasePassword)

p_dbPassword=strDataBasePassword

End Property

Public Property Get SQLDataSource

SQLDataSource=p_sqlDataSource

End Property

Public Property Let SQLDataSource(strSQLDataSource)

If strsqlDataSource<>"" Then

If Left(p_dbType,1)=2 Then

p_sqlDataSource=strSQLDataSource

Else

AddErrorCode(110)

p_sqlDataSource=""

End If

End If

End Property

Public Property Let PageSize(int_PageSize)

If IsNumeric(Int_Pagesize) Then

p_rsPageSize=CLng(int_PageSize)

End If

End Property

Public Property Get PageSize

If p_rsPageSize="" or NOT IsNumeric(p_rsPageSize) Then

PageSize=8

Else

PageSize=p_rsPageSize

End If

End Property

Public Property Get GetRs()

If NOT Debug Then On Error Resume Next

If NOT IsObject(objConn) Then ConnectionDataBase dbDataBase,dbUserID,dbPassword,dbType

If NOT IsObject(rsDivPage) Then

Set rsDivPage=Server.createobject("adodb.recordset")

rsDivPage.Open GetSQL,objConn,1,1

rsDivPage.PageSize=PageSize

If not(rsDivPage.eof and rsDivPage.BOF) Then

If p_intCurPage>rsDivPage.PageCount Then

p_intCurPage=rsDivPage.PageCount

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

[1] [2] [3] [4] 下一页

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有