gusucode.com > 爱美尔女性商城源码 1.0源码程序 > ParamChk.asp
<% function JsWrite( s ) response.Write( "<script>"&s&"</script>" ) end function function JsGo( s ) response.clear() JsWrite("location.href='"&s&"'") response.end() end function function JsBack() response.clear() JsWrite("history.go(-1)") response.end() end function function JsSay( s ) JsWrite("alert('"&s&"')") end function function JsSayBack( s ) response.clear() response.Write "<script>alert('"&s&"');history.go(-1);</script>" response.end() end function function JsSayGo( s , url ) response.clear() response.Write "<script>alert('"&s&"');location.href='"&url&"'</script>" response.end() end function function JsSayTopGo( s , url ) response.clear() response.Write "<script>alert('"&s&"');top.location.href='"&url&"'</script>" response.end() end function function RsOpen( sql ) if rs.state then rs.close rs.open sql,conn,1,3 end function function ToInt( s ) if isnumeric( s ) then ToInt=clng( s ) else ToInt=0 end function function ToStr( s ) ToStr=replace(trim(s&""), "'","’") end function function ToHtm( s ) Dim regEx SET regEx = New Regexp regEx.IgnoreCase = True regEx.Global = True regEx.Pattern = "<[/]*table[^/>]*>" s = regEx.Replace(s,"") regEx.Pattern = "<tr[^/>]*>" s = regEx.Replace(s,"") regEx.Pattern = "</tr[^/>]*>" s = regEx.Replace(s,"<br>") regEx.Pattern = "<[/]*td[^/>]*>" s = regEx.Replace(s,"") regEx.Pattern = "<[/]*tbody[^/>]*>" s = regEx.Replace(s,"") regEx.Pattern = "<img[^/>]*>" s = regEx.Replace(s,"") ToHtm=ToStr( s ) 'ToHtm=replace(replace(replace(replace(replace(replace(replace(replace(trim(s&""),"'","’"),"*","×"),"?","?"),"(","("),")",")"),"<","〈"),".","。"),";",";") end function function ToDelId( s ) s = split(s,",") for i=0 to UBound(s) if ToInt(s(i))=0 then JsSayBack("参数错误,请选择要删除的记录!") end if next s = join(s,",") ToDelId = s end function function ReqInt( s ) ReqInt=ToInt(request(s)) end function function ReqStr( s ) ReqStr=ToStr(request(s)) end function Function ReqHtm(htmlStr) Dim regEx SET regEx = New Regexp regEx.IgnoreCase = True regEx.Global = True regEx.Pattern = "<.+?>" htmlStr = regEx.Replace(htmlStr,"") htmlStr = Replace(htmlStr, "<","<") htmlStr = Replace(htmlStr, ">",">") htmlStr = Replace(htmlStr,chr(10),"") htmlStr = Replace(htmlStr,chr(13),"") ReqHtm = ToHtm(request(htmlStr)) SET regEx = Nothing End Function function ReqDelId( s ) ReqDelId=ToDelId(request(s)) end function function RsInt( s ) if rs.state then if not rs.eof then RsInt=ToInt(rs(s)) else RsInt=0 else RsInt=0 end if end function function RsStr( s ) if rs.state then if not rs.eof then RsStr=ToStr(rs(s)) else RsStr="" else RsStr="" end if end function function RsLeft( s , slen ) if rs.state then if not rs.eof then s=ToStr(rs(s)) else s="" else s="" end if if len(s)>slen then s=left(s,slen)&".." RsLeft=s end function function RsHtm( s , slen ) if rs.state then if not rs.eof then s=ToHtm(rs(s)) else s="" else s="" end if if len(s)>slen then s=left(s,slen) fi=InStrRev( s , "<" ) if fi > InStrRev( s , ">" ) then s=left(s,fi-1) s=s&".." end if RsHtm=s end function function RsDateTime( s ) if rs.state then if not rs.eof then RsDateTime=ToStr(rs(s)) else RsDateTime="" else RsDateTime="" end if end function function RsDate( s ) s=RsDateTime( s ) fi = InStr( s , " " ) if fi>0 then s=mid( s , 1 , fi-1 ) RsDate=s end function Function FilterHtml(str,strlen) Dim re Set re=new RegExp re.IgnoreCase =True re.Global=True re.Pattern="<(.[^>]*)>" str=re.Replace(str,"") set re=Nothing Dim l,t,c,i l=Len(str) t=0 For i=1 to l c=Abs(Asc(Mid(str,i,1))) If c>255 Then t=t+2 Else t=t+1 End If If t>=strlen Then cutStr=left(str,i)&"..." Exit For Else cutStr=str End If Next cutStr=Replace(cutStr,chr(10),"") cutStr=Replace(cutStr,chr(13),"") FilterHTML= cutStr End Function %>