【asp检测是否为中文字符函数】教程文章相关的互联网学习教程文章

asp中将相对路径转换为绝对路径的函数代码

代码如下:'================================================ ' 函数名:ChkMapPath ' 作 用:相对路径转换为绝对路径 ' 参 数:strPath ----原路径 ' 返回值:绝对路径 '================================================ Function ChkMapPath(ByVal strPath) Dim fullPath strPath = Replace(Replace(Trim(strPath), "/", "\"), "\\", "\") If strPath = "" Then strPath = "." If InStr(strPath,":\") = 0 Then fullPath = Se...

asp CutStrX字符串截取函数(过滤全部HTML标记)

代码如下:Function CutStrX(ByVal Str,ByVal StrLen) Dim l,t,c,i,r 过滤全部HTML标记 Set r=New RegExp r.Global=True r.MultiLine=True r.Pattern="(</?[A-Za-z][A-Za-z0-9]*[^>]*>)" str=r.Replace(str," ") Set r=Nothing l=Len(str) t=0 For i=1 To l c=AscW(Mid(str,i,1)) If c<0 Or c>255 Then t=t+2 Else t=t+1 IF t>=StrLen Then CutStrX=Left(Str,i)&"..." Exit For Else CutStrX=Str End If Next End Function

ASP下检测图片木马的函数代码

木马原理:入侵者使用诸如ASP图片木马生成器之类的工具将一张正常的图片与一个ASP木马文件合并成一个图片文件(即将对网站有害的 ASP代码插在图片编码之后,虽然图片仍然可以正常显示,但是文件内容和尺寸已被改变),然后通过网站提供的文件上传功能上传这一张“合 '法的”图片,进而实现了上传ASP木马的目的。 ' 防范方法:因为这种木马是图片与木马的二合一,所以需要在上传图片前检查文件内容,若文件内容不合法(即包含有恶意...

ASP 使用Filter函数来检索数组的实现代码

语法说明: Filter 函数 返回下标从零开始的 数组,其中包含以特定过滤条件为基础的字符串数组的子集。 Filter(InputStrings, Value[, Include[, Compare]]) 参数 InputStrings 必选项。一维数组,要在其中搜索字符串。 Value 必选项。要搜索的字符串。 Include 可选项。Boolean 值,指定返回的子字符串是否包含 Value。如果 Include 为 True,Filter 将返回包含子字符串 Value 的数组子集。如果 Include 为 False,Filter 将返回不...

asp中判断服务器是否安装了某种组件的函数

判断服务器是否安装了某种asp组件,比较常用的代码如下: 代码如下:<% 功能:检查是否存在系统组件或组件是否安装成功 参数:组件名 Function IsObjInstalled(strClassString) On Error Resume Next IsObjInstalled = False Err = 0 Dim xTestObj Set xTestObj = Server.CreateObject(strClassString) If 0 = Err Then IsObjInstalled = True Set xTestObj = Nothing Err = 0 End Function 获取系统组件的版本号 Function getver(Clas...

ASP的URLDecode函数URLEncode解码函数

下面的代码是从kesion系统扒下的,确实不错,支持utf8格式。 代码如下:'================================================ '函数名:URLDecode '作 用:URL解码 '================================================ Function URLDecode(ByVal urlcode) Dim start,final,length,char,i,butf8,pass Dim leftstr,rightstr,finalstr Dim b0,b1,bx,blength,position,u,utf8 On Error Resume Next b0 = Array(192,224,240,248,252,254) ...

asp中文件与文件夹常用处理函数(文件后缀、创建文件等)

代码如下:'===================================== '获得文件后缀 '===================================== Function Get_Filetxt(ByVal t0) Dim t1 IF Len(t0)<2 Or Instr(t0,".")=0 Then Get_Filetxt=False:Exit Function t1=Split(t0,".") Get_Filetxt=Lcase(t1(Ubound(t1))) End Function '===================================== '读取任何文件的纯代码 '===================================== Function LoadFile(ByVal t0) ...

asp中获取当前页面的地址与参数的函数代码

代码如下:Function getCurrentUrl() On Error Resume Next Dim strTemp If LCase(Request.ServerVariables("HTTPS")) = "off" Then strTemp = "http://" Else strTemp = "https://" End If strTemp = strTemp & Request.ServerVariables("SERVER_NAME") If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT") end if strTemp = strTemp & Request.ServerVariab...

ASP读取日期单日期自动补零函数代码

代码如下:public function fillzero(l1) if len(l1)=1 then fillzero="0"&l1 else fillzero=l1 end if end function 用法示例: 代码如下:response year(now)&month(now)&day(now) 结果:201116 response year(now)&fillzero(month(now))&fillzero(day(now)) 显示结果:20110106 如何控制长日期格式和短日期格式的显示: Short Date:FORMATDATETIME(DATE,vbShortDate) Long Date:FORMATDATETIME(DATE,vbLongDate) 当根据英国(美国...

获取一个数字的个位、十位、百位的函数代码

代码如下:Function NumberSplit(num) Dim i,length length=Len(num) For i=1 To length NumberSplit=NumberSplit & num mod 10 & "," 余数 num = num \ 10 整除 Next NumberSplit=Left(NumberSplit,Len(NumberSplit)-1) End Function

asp中常用的字符串安全处理函数集合(过滤特殊字符等)

代码如下:'===================================== '转换内容,防止意外 '===================================== Function Content_Encode(ByVal t0) IF IsNull(t0) Or Len(t0)=0 Then Content_Encode="" Else Content_Encode=Replace(t0,"<","<") Content_Encode=Replace(Content_Encode,">",">") End IF End Function '===================================== '反转换内容 '===================================== Function Con...

asp中格式化HTML函数代码 SDCMS加强版

代码如下:'============================== '格式化HTML,SDCMS加强版 '============================== Function Nohtml(ByVal t0) IF Len(t0)=0 Or IsNull(t0) Then Nohtml="" Exit Function End IF Dim Regs,Matches,Match Set Regs=New Regexp Regs.Ignorecase=True Regs.Global=True '过滤掉JS,Iframe Regs.pattern ="<script.+?/script>" t0=Regs.Replace(t0,"") Regs.pattern ="<iframe.+?/iframe>" t0=Regs.Replace(t0,"")...

asp数字或者字符排序函数代码

代码如下:排序 Function Sort1(ary) Dim KeepChecking,I,FirstValue,SecondValue KeepChecking = TRUE Do Until KeepChecking = FALSE KeepChecking = FALSE For I = 0 to UBound(ary) If I = UBound(ary) Then Exit For If ary(I) > ary(I+1) Then FirstValue = ary(I) SecondValue = ary(I+1) ary(I) = SecondValue ary(I+1) = FirstValue KeepChecking = TRUE End If Next Loop Sort1 = ary End Function Dim arr arr = Array("...

ASP URL反编码函数代码

例如:我们在百度中搜索 脚本之家,则网址后面的参数就是http://www.gxlsystem.com/s?cl=3&wd=%BD%C5%B1%BE%D6%AE%BC%D2如果我们想将%BD%C5%B1%BE%D6%AE%BC%D2还原为中文,使用下面的函数即可。<% response.write urldecode("http://www.gxlsystem.com/s?cl=3&wd=%BD%C5%B1%BE%D6%AE%BC%D2") '================================================ '函数名:URLDecode '作 用:URL解码 '============================================...

asp下过滤非法的SQL字符的函数代码

代码如下:'************************************************** '函数名:R '作 用:过滤非法的SQL字符 '参 数:strChar-----要过滤的字符 '返回值:过滤后的字符 '************************************************** Public Function R(strChar) If strChar = "" Or IsNull(strChar) Then R = "":Exit Function Dim strBadChar, arrBadChar, tempChar, I 'strBadChar = "$,#,',%,^,&,?,(,),<,>,[,],{,},/,\,;,:," & Chr(34) & ...