![asp的函数集[学练结合]_第1页](http://file2.renrendoc.com/fileroot_temp3/2021-5/15/071b8956-f485-4196-a410-11fa4c49c489/071b8956-f485-4196-a410-11fa4c49c4891.gif)
![asp的函数集[学练结合]_第2页](http://file2.renrendoc.com/fileroot_temp3/2021-5/15/071b8956-f485-4196-a410-11fa4c49c489/071b8956-f485-4196-a410-11fa4c49c4892.gif)
![asp的函数集[学练结合]_第3页](http://file2.renrendoc.com/fileroot_temp3/2021-5/15/071b8956-f485-4196-a410-11fa4c49c489/071b8956-f485-4196-a410-11fa4c49c4893.gif)
![asp的函数集[学练结合]_第4页](http://file2.renrendoc.com/fileroot_temp3/2021-5/15/071b8956-f485-4196-a410-11fa4c49c489/071b8956-f485-4196-a410-11fa4c49c4894.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、%StartTime=timer()程序执行时间检测#VIBOVIBOSTUDIO版权所有Author:ViboEmail:vibo_-ViboASP站点开发常用函数库-OpenDB(vdata_url)-打开数据库getIp()-得到真实IPgetIPAdress(sip)-查找ip对应的真实地址IP2Num(sip)-限制某段IP地址chkFrom()-防站外提交设定getsys()-操作系统检测GetBrowser()-浏览器版本检测GetSearcher()-识别搜索引擎-数据过滤-CheckStr(byValChkStr)-检查无效字符CheckSql()-
2、防止SQL注入UnCheckStr(Str)-检查非法sql命令Checkstr(Str)-ASP最新SQL防注入过滤涵数HTMLEncode(reString)-过滤转换HTML代码DateToStr(DateTime,ShowType)-日期转换函数Date2Chinese(iDate)-获得ASP的中文日期字符串lenStr(str)-计算字符串长度(字节)CreateArr(str)-生成二维数组ShowRsArr(rsArr)-用表格显示记录集getrows生成的数组的表结构-外接组件使用函数-sendMail(to_Email,from_Email,from_Name,mail_S
3、ubject,mail_Body,mail_htmlBody)-Jmail组件发送邮件-系统检测函数-IsValidUrl(url)-检测网页是否有效getHTMLPage(filename)-获取文件内容CheckFile(FilePath)-检查某一文件是否存在CheckDir(FolderPath)-检查某一目录是否存在MakeNewsDir(foldername)-根据指定名称生成目录CreateHTMLPage(filename,FileData,C_mode)生成文件CheckBadWord(byValChkStr)-过滤脏字#DimipData_urlipData_url=./I
4、p.mdbResponse.Write(-客户端信息检测-&)Response.Write(getsys()&)Response.Write(GetBrowser()&)Response.Write(GetSearcher()&)Response.Write(IP:&getIp()&)Response.Write(来源:&(getIPAdress(GetIp()&)Response.Write()Response.Write(-数据提交检测-&)ifnotchkFromthenResponse.write(请不要从站外提交内容!&)Response.endelseResponse.write(
5、本站提交内容!&)EndiffunctionOpenDB(vdata_url)-打开数据库使用:Conn=OpenDB(data/data.mdb)Dimvibo_ConnSetvibo_Conn=Server.CreateObject(ADODB.Connection)vibo_Conn.ConnectionString=Provider=Microsoft.Jet.OLEDB.4.0;DataSource=&Server.MapPath(vdata_url)vibo_Conn.OpenOpenDB=vibo_ConnEndFunctionfunctiongetIp()-得到真实IPuser
6、ip=Request.ServerVariables(HTTP_X_FORWARDED_FOR)Ifuserip=Thenuserip=Request.ServerVariables(REMOTE_ADDR)getIp=useripEndfunctionFunctiongetIPAdress(sip)-查找ip对应的真实地址Dimiparr,iprs,country,cityIfsip=thensip=iparr=split(sip,.)sip=cint(iparr(0)*256*256*256+cint(iparr(1)*256*256+cint(ip
7、arr(2)*256+cint(iparr(3)-1Dimvibo_ipconn_STRINGvibo_ipconn_STRING=Provider=Microsoft.Jet.OLEDB.4.0;DataSource=&Server.MapPath(ipData_url)Setiprs=Server.CreateObject(ADODB.Recordset)iprs.ActiveConnection=vibo_ipconn_STRINGiprs.Source=SelectTop1city,countryFROMaddressWhereip1=&sip&and&sip&IP2Num(192.1
8、68.0.0)anduserIPnumIP2Num(55)thenresponse.write(您的IP被禁止)response.endendifFunctionchkFrom()-防站外提交设定Dimserver_v1,server_v2,server1,server2chkFrom=Falseserver1=Cstr(Request.ServerVariables(HTTP_REFERER)server2=Cstr(Request.ServerVariables(SERVER_NAME)IfMid(server1,8,len(server2)=server2Thenc
9、hkFrom=TrueEndFunctionifnotchkFromthenResponse.write(请不要从站外提交内容!)Response.endEndiffunctiongetsys()-操作系统检测vibo_soft=Request.ServerVariables(HTTP_USER_AGENT)ifinstr(vibo_soft,WindowsNT5.0)thenmsm=Win2000elseifinstr(vibo_soft,WindowsNT5.1)thenmsm=WinXPelseifinstr(vibo_soft,WindowsNT5.2)thenmsm=Win2003e
10、lseifinstr(vibo_soft,4.0)thenmsm=WinNTelseifinstr(vibo_soft,NT)thenmsm=WinNTelseifinstr(vibo_soft,WindowsCE)thenmsm=WindowsCEelseifinstr(vibo_soft,Windows9)thenmsm=Win9xelseifinstr(vibo_soft,9x)thenmsm=WindowsMEelseifinstr(vibo_soft,98)thenmsm=Windows98elseifinstr(vibo_soft,Windows95)thenmsm=Windows
11、95elseifinstr(vibo_soft,Win32)thenmsm=Win32elseifinstr(vibo_soft,unix)orinstr(vibo_soft,linux)orinstr(vibo_soft,SunOS)orinstr(vibo_soft,BSD)thenmsm=类Unixelseifinstr(vibo_soft,Mac)thenmsm=Macelsemsm=Otherendifgetsys=msmEndFunctionfunctionGetBrowser()-浏览器版本检测dimvibo_softvibo_soft=Request.ServerVariabl
12、es(HTTP_USER_AGENT)Browser=unknownversion=unknownvibo_soft=Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.0;TencentTraveler;.NETCLR1.1.4322)IfLeft(vibo_soft,7)=MozillaThen有此标识为浏览器vibo_soft=Split(vibo_soft,;)IfInStr(vibo_soft(1),MSIE)0ThenBrowser=MicrosoftInternetExplorerversion=Trim(Left(Replace(vibo_sof
13、t(1),MSIE,),6)ElseIfInStr(vibo_soft(4),Netscape)0ThenBrowser=Netscapetmpstr=Split(vibo_soft(4),/)version=tmpstr(UBound(tmpstr)ElseIfInStr(vibo_soft(4),rv:)0ThenBrowser=Mozillatmpstr=Split(vibo_soft(4),:)version=tmpstr(UBound(tmpstr)IfInStr(version,)0Thentmpstr=Split(version,)version=tmpstr(0)EndIfEn
14、dIfElseIfLeft(vibo_soft,5)=OperaThenvibo_soft=Split(vibo_soft,/)Browser=Mozillatmpstr=Split(vibo_soft(1),)version=tmpstr(0)EndIfIfversionunknownThenDimTmpstr1Tmpstr1=Trim(Replace(version,.,)IfNotIsNumeric(Tmpstr1)Thenversion=unknownEndIfEndIfGetBrowser=Browser&versionEndfunctionfunctionGetSearcher()
15、-识别搜索引擎Dimbotlist,SearcherDimvibo_softvibo_soft=Request.ServerVariables(HTTP_USER_AGENT)Botlist=Google,Isaac,SurveyBot,Baiduspider,ia_archiver,P.Arthur,FAST-WebCrawler,Java,Microsoft-ATL-Native,TurnitinBot,WebGather,Sleipnir,TencentTravelerBotlist=split(Botlist,)Fori=0toUBound(Botlist)IfInStr(vibo_s
16、oft,Botlist(i)0ThenSearcher=Botlist(i)&搜索器IsSearch=TrueExitForEndIfNextIfIsSearchThenGetSearcher=SearcherelseGetSearcher=unknownEndifEndfunction-数据过滤-FunctionCheckSql()防止SQL注入Dimsql_injdataSQL_injdata=|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declareSQL_inj=split(S
17、QL_Injdata,|)IfRequest.QueryStringThenForEachSQL_GetInRequest.QueryStringForSQL_Data=0ToUbound(SQL_inj)ifinstr(Request.QueryString(SQL_Get),Sql_Inj(Sql_DATA)0ThenResponse.Writealert(请不要在参数中包含非法字符!);history.back(-1)Response.endendifnextNextEndIfIfRequest.FormThenForEachSql_PostInRequest.FormForSQL_Da
18、ta=0ToUbound(SQL_inj)ifinstr(Request.Form(Sql_Post),Sql_Inj(Sql_DATA)0ThenResponse.Writealert(请不要在参数中包含非法字符!);history.back(-1)Response.endendifnextnextendifEndFunctionFunctionCheckStr(byValChkStr)检查无效字符DimStr:Str=ChkStrStr=Trim(Str)IfIsNull(Str)ThenCheckStr=ExitFunctionEndIfDimreSetre=newRegExpre.Ig
19、noreCase=Truere.Global=Truere.Pattern=(rn)3,Str=re.Replace(Str,$1$1$1)Setre=NothingStr=Replace(Str,)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,updat
20、e)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)CheckStr=StrEndFunctionFunctionUnCheckStr(Str)检查非法sql命令Str=Replace(Str,select,select)Str=Replace(Str,j
21、oin,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
22、=Replace(Str,alter,alter)Str=Replace(Str,cast,cast)UnCheckStr=StrEndFunctionFunctionCheckstr(Str)SQL防注入过滤涵数IfIsnull(Str)ThenCheckStr=ExitFunctionEndIfStr=Replace(Str,Chr(0),1,-1,1)Str=Replace(Str,1,-1,1)Str=Replace(Str,1,-1,1)Str=Replace(Str,script,script,1,-1,0)Str=Replace(Str,SCRIPT,SCRIPT,1,-1,0)
23、Str=Replace(Str,Script,Script,1,-1,0)Str=Replace(Str,script,Script,1,-1,1)Str=Replace(Str,object,object,1,-1,0)Str=Replace(Str,OBJECT,OBJECT,1,-1,0)Str=Replace(Str,Object,Object,1,-1,0)Str=Replace(Str,object,Object,1,-1,1)Str=Replace(Str,applet,applet,1,-1,0)Str=Replace(Str,APPLET,APPLET,1,-1,0)Str=
24、Replace(Str,Applet,Applet,1,-1,0)Str=Replace(Str,applet,Applet,1,-1,1)Str=Replace(Str,)Str=Replace(Str,)Str=Replace(Str,1,-1,1)Str=Replace(Str,=,=,1,-1,1)Str=Replace(Str,1,-1,1)Str=Replace(Str,select,select,1,-1,1)Str=Replace(Str,execute,execute,1,-1,1)Str=Replace(Str,exec,exec,1,-1,1)Str=Replace(St
25、r,join,join,1,-1,1)Str=Replace(Str,union,union,1,-1,1)Str=Replace(Str,where,where,1,-1,1)Str=Replace(Str,insert,insert,1,-1,1)Str=Replace(Str,delete,delete,1,-1,1)Str=Replace(Str,update,update,1,-1,1)Str=Replace(Str,like,like,1,-1,1)Str=Replace(Str,drop,drop,1,-1,1)Str=Replace(Str,create,create,1,-1
26、,1)Str=Replace(Str,rename,rename,1,-1,1)Str=Replace(Str,count,count,1,-1,1)Str=Replace(Str,chr,chr,1,-1,1)Str=Replace(Str,mid,mid,1,-1,1)Str=Replace(Str,truncate,truncate,1,-1,1)Str=Replace(Str,nchar,nchar,1,-1,1)Str=Replace(Str,char,char,1,-1,1)Str=Replace(Str,alter,alter,1,-1,1)Str=Replace(Str,cas
27、t,cast,1,-1,1)Str=Replace(Str,exists,exists,1,-1,1)Str=Replace(Str,Chr(13),1,-1,1)CheckStr=Replace(Str,1,-1,1)EndFunctionFunctionHTMLEncode(reString)过滤转换HTML代码DimStr:Str=reStringIfNotIsNull(Str)ThenStr=UnCheckStr(Str)Str=Replace(Str,&,&)Str=Replace(Str,)Str=Replace(Str,)Str=Replace(Str,CHR(32),)Str=
28、Replace(Str,CHR(9),)Str=Replace(Str,CHR(9),)Str=Replace(Str,CHR(34),)Str=Replace(Str,CHR(39),)Str=Replace(Str,CHR(13),)Str=Replace(Str,CHR(10),)HTMLEncode=StrEndIfEndFunctionFunctionDateToStr(DateTime,ShowType)日期转换函数DimDateMonth,DateDay,DateHour,DateMinuteDateMonth=Month(DateTime)DateDay=Day(DateTim
29、e)DateHour=Hour(DateTime)DateMinute=Minute(DateTime)IfLen(DateMonth)2ThenDateMonth=0&DateMonthIfLen(DateDay)12ThenDateHour=DateHour-12DateAMPM=PMElseDateHour=DateHourDateAMPM=AMEndIfIfLen(DateHour)2ThenDateHour=0&DateHourIfLen(DateMinute)2ThenDateMinute=0&DateMinuteDateToStr=Year(DateTime)&-&DateMon
30、th&-&DateDay&DateHour&:&DateMinute&DateAMPMCaseY-m-dH:I:SDimDateSecondDateSecond=Second(DateTime)IfLen(DateHour)2ThenDateHour=0&DateHourIfLen(DateMinute)2ThenDateMinute=0&DateMinuteIfLen(DateSecond)2ThenDateSecond=0&DateSecondDateToStr=Year(DateTime)&-&DateMonth&-&DateDay&DateHour&:&DateMinute&:&Dat
31、eSecondCaseYmdHISDateSecond=Second(DateTime)IfLen(DateHour)2ThenDateHour=0&DateHourIfLen(DateMinute)2ThenDateMinute=0&DateMinuteIfLen(DateSecond)2ThenDateSecond=0&DateSecondDateToStr=Year(DateTime)&DateMonth&DateDay&DateHour&DateMinute&DateSecondCaseymDateToStr=Right(Year(DateTime),2)&DateMonthCasedDateT
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【正版授权】 ISO/IEC 29110-5-1-1:2025 EN Systems and software engineering - Life cycle profiles for very small entities (VSEs) - Part 5-1-1: Software engineering guidelines for the gener
- 【正版授权】 ISO/IEC 27035-4:2024 EN Information technology - Information security incident management - Part 4: Coordination
- 酒店设施改造与管理输出合同
- 网络安全评估及防护服务合同
- 挂靠房地产公司协议书
- 简易离婚协议书
- 技师劳动合同
- 爱眼日学校活动方案(3篇)
- 美容院会员卡转让合同
- 网络直播活动策划方案
- 浙江省2023年中考语文试题【8套】(含答案)
- 4.1.2 实数指数幂-参考课件
- 【工商管理专业毕业综合训练报告2600字(论文)】
- 小学生四年级健康知识讲座
- 中医主任述职报告
- 通防培训课件
- 音乐识谱节奏训练课件
- 七年级数学上册期末试卷(可打印)
- 学前儿童游戏(中职学前教育专业)PPT完整版全套教学课件
- GN汽车吊吊装专项安全方案讲义
- 初中历史-《开元盛世 》教学课件设计
评论
0/150
提交评论