书签 分享 收藏 举报 版权申诉 / 87

类型ASP功能函数大全.docx

  • 文档编号:5849982
  • 上传时间:2023-01-01
  • 格式:DOCX
  • 页数:87
  • 大小:47.43KB
"

response.End()

endsub

'转向

SubRedirectUrl(strHttp)

Response.write"location.href='"&strHttp&"';"

EndSub

subAlert(sText)

Response.write"alert('"&sText&"');"

endsub

subHistory(iStep)

Response.write""

EndSub

subFunmsg(iStep,sText)

Response.Write""

endsub

'执行非法提交检测

Subget_rq()

dimqs,errc,iii

qs=request.servervariables("query_string")

dimnothis(18)

nothis(0)="netuser"

nothis

(1)="xp_cmdshell"

nothis

(2)="/add"

nothis(3)="exec%20master.dbo.xp_cmdshell"

nothis(4)="netlocalgroupadministrators"

nothis(5)="select"

nothis(6)="count"

nothis(7)="asc"

nothis(8)="char"

nothis(9)="mid"

nothis(10)="'"

nothis(11)=":

:

"

nothis(12)=""""

nothis(13)="insert"

nothis(14)="delete"

nothis(15)="drop"

nothis(16)="truncate"

nothis(17)="from"

nothis(18)="anduser>0"

errc=false

foriii=0toubound(nothis)

ifinstr(qs,nothis(iii))<>0then

errc=true

endif

next

iferrcthen

'Response.Write("对不起,非法URL地址请求!

")

response.Write""

response.Write"

1pxsolid#CCCCCC;width:

600px;height:

25px;padding:

5px;padding-left:

15px;'>"

response.Write"

14px'>Diggcms系统友情提示:


"

response.Write"  HTTP错误404-URL地址请求出错
"

response.Write"

"

response.end

endif

EndSub

'初始化被过滤的客户端列表

FunctionwebAgent()

dimstrAgentFilter

strAgentFilter="webzip|||flashget|||offline|||teleport"

IfChkAgent(strAgentFilter)=FalseThen

response.Write"错误"

response.End()

'AddErrCode

(1)

'CallChkError()

EndIf

EndFunction

'*检查浏览站点的客户端

'*strAL——屏蔽的客户端标志列表

FunctionChkAgent(strAL)

DimAgent,iijj

ChkAgent=True

Agent=Trim(Lcase(Request.Servervariables("HTTP_USER_AGENT")))

If(NotIsNull(strAL))Then

strAL=Split(strAL,"|||")

Foriijj=0ToUbound(strAL)

IfInstr(Agent,strAL(iijj))>0Then

ChkAgent=False

endif

Next

EndIf

EndFunction

'/*

'防网站小偷来采摘数据

'*/

functionAppeal()

DimAppealNum,AppealCount

AppealNum=30'同一IP10秒内请求限制30次

AppealCount=Request.Cookies("AppealCount")

IfAppealCount=""Then

response.Cookies("AppealCount")=1

AppealCount=1

response.cookies("AppealCount").expires=dateadd("s",10,now())

Else

response.Cookies("AppealCount")=AppealCount+1

response.cookies("AppealCount").expires=dateadd("s",10,now())

EndIf

ifint(AppealCount)>int(AppealNum)then

response.Write"

350px'>描述"

response.write"

14px'>抓取很累,歇一会儿吧!


"&Website&""

response.Write""

response.end

EndIf

endfunction

'/*

'防外部提交

'结合Chkpost函数

'*/

functionchpost()

IfNotChkPost(Website)then

response.Write"

"

response.Write"

350px'>系统提示"

Response.Write"

14px'>"

response.Write"   返回"

response.Write""

response.Write"

1pxsolid#CCCCCC;width:

235px;height:

25px;padding:

5px;padding-left:

15px;'>Diggcms-给你最好的

"

response.Write""

response.End()

endif

Endfunction

'/*

'处部提交数据查

'*/

FunctionChkPost(web_url)

dimServer_V1,Server_V2

ChkPost=False

Server_V1=Cstr(Request.ServerVariables("HTTP_REFERER"))

Server_V2=Cstr(Request.ServerVariables("SERVER_NAME"))

''--------------------------------------------

''Instr(所有,其中),包括>0,否则=0

''--------------------------------------------

IfMid(Server_V1,8,Len(Server_V2))<>Server_V2orInstr(web_url,Server_V2)=0Then

ChkPost=False

Else

ChkPost=True

EndIf

EndFunction

'========================================================文件操作

'/*

'删除文件

'*/

FunctionDelFile(DelFilePath)

OnErrorResumeNext

DelFile=False

setMyFileObject=Server.CreateOBject("Scripting.FileSystemObject")

MyFileObject.DeleteFile""&Server.MapPath(""&DelFilePath&"")&""

SetMyFileObject=Nothing

If0=Error53=ErrThen

DelFile=True

else

CatchError(""&DelFilePath&"文件无法删除!

")

endif

OnErrorGoTo0

EndFunction

'/*

'检查多层目录不存在,则生成

'*/

functionCreateDIR(LocalPath)

dimpatharr,path_level,i,pathtmp,cpath,FileObject

onerrorresumenext

LocalPath=Server.MapPath(LocalPath)

LocalPath=replace(LocalPath,"\","/")

setFileObject=server.createobject("Scripting.FileSystemObject")

patharr=split(LocalPath,"/")

path_level=ubound(patharr)

fori=0topath_level

ifi=0thenpathtmp=patharr(0)&"/"elsepathtmp=pathtmp&patharr(i)&"/"

cpath=left(pathtmp,len(pathtmp)-1)

ifnotFileObject.FolderExists(cpath)thenFileObject.CreateFolder(cpath)

next

setFileObject=nothing

iferr.number<>0then

CreateDIR=false

err.Clear

else

CreateDIR=true

endif

endfunction

'/*

'cookie编码加密

'*/

FunctionCodeCookie(Str)

Dimi

DimStrRtn

Fori=Len(Str)To1Step-1

StrRtn=StrRtn&AscW(Mid(Str,i,1))

If(i<>1)ThenStrRtn=StrRtn&"a"

Next

CodeCookie=StrRtn

EndFunction

'/*

'cookie解密

'*/

FunctionDecodeCookie(Str)

Dimi

DimStrArr,StrRtn

StrArr=Split(Str,"a")

Fori=0ToUBound(StrArr)

IfIsNumeric(StrArr(i))=TrueThen

StrRtn=ChrW(StrArr(i))&StrRtn

Else

StrRtn=Str

ExitFunction

EndIf

Next

DecodeCookie=StrRtn

EndFunction

'/*

'*设置Cookies

'*vparameter:

参数,val:

'*/

FunctionSetCookies(vparameter,val)

response.Cookies(vparameter)=val

response.Cookies(vparameter).Expires=dateadd("H",12,now())

EndFunction

'/*

'* 读取Cookies

'*/

FunctionGetCookies(vparameter)

GetCookies=request.Cookies(vparameter)

EndFunction

'============================================================安全过滤

'/*

'安全过滤

'*/

FunctionSafeSql(Str,Flag)

SafeSql=Str

IfFlag=1Then

IfNotIsNumeric(SafeSql)OrTrim(SafeSql)=""Then

'response.Write""

response.Write"

350px'>描述"

Response.Write"

14px'>参数错误,参数类型应为数值型。


当前值是:

"&Str&""

response.Write""

response.Write"

1pxsolid#CCCCCC;width:

235px;height:

25px;padding:

5px;padding-left:

15px;'>好财经-给你最好的

"

Response.End

EndIf

ElseIfFlag=2Then

Str=trim(Str)

Str=replace(Str,">",">")

Str=replace(Str,"<","<")

Str=Replace(Str,"\","\")

Str=Replace(Str,"--","--")

Str=Replace(Str,CHR(34),""")'过滤''

Str=Replace(Str,CHR(39),"'")'过滤'

'Str=Replace(Str,CHR(13)&CHR(10),"
")'回车换行

Str=Replace(Str,CHR(42),"*")'“*”

Str=Replace(Str,CHR(44),",")'“,”

Str=Replace(Str,"select","select")

Str=Replace(Str,"join","join")

Str=Replace(Str,"union","union")

Str=Replace(Str,"where","where")

Str=Replace(Str,"insert","insert")

Str=Replace(Str,"delete","delete")

Str=Replace(Str,"update","update")

Str=Replace(Str,"like","like")

Str=Replace(Str,"drop","drop")

Str=Replace(Str,"create","create")

Str=Replace(Str,"modify","modify")

Str=Replace(Str,"rename","rename")

Str=Replace(Str,"alter","alter")

Str=Replace(Str,"cast","cast")

SafeSql=Str

Else

response.Write"

350px'>描述"

Response.Write"

14px'>参数错误SafeSql方法参数在1,2范围内"

response.Write""

response.Write"

1pxsolid#CCCCCC;width:

235px;height:

25px;padding:

5px;padding-left:

15px;'>好财经-给你最好的

"

Response.End

EndIf

EndFunction

'/*

'HTML解码函数

'*/

FunctionHTMLDecode(refStringing)

DimfString

fString=refStringing

IfNotIsNull(fString)Then

fString=Replace(fString,">",">")

fString=Replace(fString,"<","<")

fString=Replace(fString,"\","\")

fString=Replace(fString,"--","--")

fString=Replace(fString,""",CHR(34))'还原''

fString=Replace(fString,"'","'")'还原'

'ifinstr(fString,CHR(13)&CHR(10))>0then

'fString=Replace(fString,CHR(13)&CHR(10),"
")'回车换行

'endif

fString=Replace(fString,"select","select")

fString=Replace(fString,"join","join")

fString=Replace(fString,"union","union")

fString=Replace(fString,"where","where")

fString=Replace(fString,"insert","insert")

fString=Replace(fString,"delete","delete")

fString=Replace(fString,"update","update")

fString=Replace(fString,"like","like")

fString=Replace(fString,"drop","drop")

fString=Replace(fString,"create","create")

fString=Replace(fString,"modify","modify")

fString=Replace(fString,"rename","rename")

fString=Replace(fString,"alter","alter")

fString=Replace(fString,"cast","cast")

HTMLDecode=fString

EndIf

EndFunction

'/*

'防注入

'*/

FunctionFunSQL(Str)

IfIsnull(Str)Then

FunSQL=""

ExitFunction

EndIf

Str=trim(Str)

Str=Replace(Str,Chr(0),"",1,-1,1)

Str=Replace(Str,"""",""",1,-1,1)

Str=Replace(Str,"<","<",1,-1,1)

Str=Replace(Str,">",">",1,-1,1)

Str=

举报
举报
版权申诉
版权申诉
word格式文档无特别注明外均可编辑修改;预览文档经过压缩,下载后原文更清晰! 立即下载
配套讲稿:

如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

特殊限制:

部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

关 键  词:
ASP 功能 函数 大全
提示  冰豆网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:ASP功能函数大全.docx
链接地址:https://www.bdocx.com/doc/5849982.html
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2008-2022 冰点文档网站版权所有

经营许可证编号:鄂ICP备2022015515号-1

收起
展开