<% dim connstr dim db dim conn connstr = "Driver={SQL Server};SERVER=127.0.0.1;" _ &"UID=zixunmanage;Password=taokemanage;DATEBASE=zixun;" set conn = server.createobject("adodb.connection") conn.open connstr If Err Then err.Clear Set Conn = Nothing Response.Write "数据库连接出错,请检查连接字串。" Response.End End If Sub CloseConn() 'On Error Resume Next Conn.close set Conn=nothing End sub Session.Timeout = 120 'session时为120 %> <% '==========过滤js function movekh(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=true objregexp.pattern="\<.+?\>" ddd=objregexp.replace(str,"") 'objregexp.pattern="\<[^\<]+>" movekh=objregexp.replace(ddd,"") end function '==========过滤括号 function moveykh(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=true objregexp.pattern="\(.+?\)" ccc=objregexp.replace(str,"") 'objregexp.pattern="\<[^\<]+>" moveykh=objregexp.replace(ccc,"") end function rem**************************************************** rem 编 写:李平 rem 过程名:InterceptString rem 作 用:截取字符串长度 rem 参 数:txt 需要截取的字符串 rem 参 数:length 截取字符串的长度,从左侧截起 rem **************************************************** Function InterceptString(txt,length) dim x,y,ii txt=trim(txt) x = len(txt) y = 0 if x >= 1 then for ii = 1 to x if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then '如果是汉字 y = y + 2 else y = y + 1 end if if y >= length then txt = left(trim(txt),ii) '字符串限长 exit for end if next InterceptString = txt else InterceptString = "" end if End Function '==========过滤js function movejs(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True 'objregexp.Multiline = True objregexp.Pattern = "" movejs=objregexp.replace(str,"") Set objregexp=Nothing end function '==========过滤 function movediv(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True 'objregexp.Multiline = True objregexp.Pattern = "{1}" movediv=objregexp.replace(str,"") movediv=replace(movediv,"","") Set objregexp=Nothing end function '==========过滤 function moveem(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True 'objregexp.Multiline = True objregexp.Pattern = "{1}" moveem=objregexp.replace(str,"") moveem=replace(moveem,"","") Set objregexp=Nothing end function '==========过滤 function moveh(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True 'objregexp.Multiline = True objregexp.Pattern = "{1}" moveh=objregexp.replace(str,"") moveh=replace(moveh,"","") Set objregexp=Nothing end function '==========过滤 function movetable(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True 'objregexp.Multiline = True objregexp.Pattern = "{1}" movetable=objregexp.replace(str,"") movetable=replace(movetable,"","") Set objregexp=Nothing end function '==========过滤 function moverem(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True 'objregexp.Multiline = True objregexp.Pattern = "{1}" moverem=objregexp.replace(str,"") Set objregexp=Nothing end function '==========过滤 function movetr(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True 'objregexp.Multiline = True objregexp.Pattern = "{1}" movetr=objregexp.replace(str,"") movetr=replace(movetr,"","") Set objregexp=Nothing end function '==========过滤 function movetd(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True 'objregexp.Multiline = True objregexp.Pattern = "{1}" movetd=objregexp.replace(str,"") movetd=replace(movetd,"","") Set objregexp=Nothing end function function moveimg(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True 'objregexp.Multiline = True objregexp.Pattern = "{1}" moveimg=objregexp.replace(str,"") moveimg=replace(moveimg,"","") Set objregexp=Nothing end function '==========过滤ifram function moveiframe(str) dim objregexp set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True objregexp.pattern="" moveiframe=objregexp.replace(str,"") Set objregexp=Nothing end function rem==========过滤form 2006-6-30 function noform(str) dim objregexp set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True objregexp.pattern="" noform=objregexp.replace(str,"") Set objregexp=Nothing end function rem ==========过滤select==================== rem 2006-6-29 function noselect(str) dim objregexp set objregexp=new regexp objregexp.ignorecase =true objregexp.global=True objregexp.pattern="" noselect=objregexp.replace(str,"") Set objregexp=Nothing end function rem =================================== end '==========过滤flash function moveflash(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=true objregexp.pattern="" moveflash=objregexp.replace(str,"") objregexp.Pattern="" moveflash=objregexp.replace(moveflash,"") Set objregexp=nothing end function '==========过滤table function notable(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=true objregexp.pattern="]>" a=objregexp.replace(str,"") objregexp.pattern="]>" a=objregexp.replace(a,"") objregexp.pattern="" a=objregexp.replace(a,"") objregexp.pattern="" a=objregexp.replace(a,"") objregexp.pattern="\" notable=objregexp.replace(a,"") Set objregexp=nothing end function '==========过滤连接 function movelink(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=true 'objregexp.pattern="" objregexp.pattern="" movelink=objregexp.replace(str,"") objregexp.pattern="" movelink=objregexp.replace(movelink,"") Set objregexp=nothing end function '==========过滤中文 function movegb(str) dim objregexp,str1 set objregexp=new regexp objregexp.ignorecase =true objregexp.global=true objregexp.pattern="[\u4e00-\u9fa5]" a=objregexp.replace(str,"") objregexp.pattern="[A-Za-z]" movegb=objregexp.replace(a,"") Set objregexp=nothing 'movegb=a end function '================================================== '函数名:noflash '作 用:过滤FLASH代码 '参 数:str ------需要过滤的字符串 '返回值:字符串中没有FLASH代码 '================================================== function noflash(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="" str=re.replace(str,"") re.Pattern="" str=re.replace(str,"") noflash=str set re=nothing end function function strnohtml(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="(\<.[^\<]*\>)" str=re.replace(str," ") re.Pattern="(\<\/[^\<]*\>)" str=re.replace(str," ") strnohtml=str set re=nothing end function '================================================== '函数名:GetCodeArray '作 用:提取链接地址,以$Array$分隔 '参 数:ConStr ------提取地址的原字符 '参 数:StartStr ------开始字符串 '参 数:OverStr ------结束字符串 '参 数:IncluL ------是否包含StartStr '参 数:IncluR ------是否包含OverStr '================================================== Function GetCodeArray(Byval ConStr,StartStr,OverStr,IncluL,IncluR) If ConStr="$False$" or ConStr="" Or IsNull(ConStr)=True or StartStr="" Or OverStr="" or IsNull(StartStr)=True Or IsNull(OverStr)=True Then GetCodeArray="$False$" Exit Function End If Dim TempStr,TempStr2,objRegExp,Matches,Match TempStr="" Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.Pattern = "("&StartStr&").+?("&OverStr&")" Set Matches =objRegExp.Execute(ConStr) For Each Match in Matches TempStr=TempStr & "$Array$" & Match.Value Next Set Matches=nothing If TempStr="" Then GetCodeArray="$False$" Exit Function End If TempStr=Right(TempStr,Len(TempStr)-7) If IncluL=False then objRegExp.Pattern =StartStr TempStr=objRegExp.Replace(TempStr,"") End if If IncluR=False then objRegExp.Pattern =OverStr TempStr=objRegExp.Replace(TempStr,"") End if Set objRegExp=nothing Set Matches=nothing 'TempStr=Replace(TempStr,"""","") 'TempStr=Replace(TempStr,"'","") 'TempStr=Replace(TempStr," ","") 'TempStr=Replace(TempStr,"(","") 'TempStr=Replace(TempStr,")","") If TempStr="" then GetCodeArray="$False$" Else GetCodeArray=TempStr End if End Function '================================================== '过程名:Admin_ShowChannel_Name '作 用:显示频道名称 '参 数:ChannelID ------频道ID '================================================== Sub Admin_ShowChannel_Name(ChannelID) Dim Sqlc,Rsc,TempStr ChannelID=Clng(ChannelID) Sqlc ="select top 1 ChannelName from PE_Channel Where ChannelID=" & ChannelID Set Rsc=server.CreateObject("adodb.recordset") Rsc.open Sqlc,Conn,1,1 If Rsc.Eof and Rsc.Bof then TempStr="无指定频道" Else TempStr=Rsc("ChannelName") End if Rsc.Close Set Rsc=Nothing response.write TempStr End Sub '================================================== '过程名:Admin_ShowChannel_Option '作 用:显示频道选项 '参 数:ChannelID ------频道ID '================================================== Sub Admin_ShowChannel_Option(ChannelID) Dim Sqlc,Rsc,ChannelName,TempStr ChannelID=Clng(ChannelID) Sqlc ="select ChannelID,ChannelName from PE_Channel where ModuleType=1 order by ChannelID asc" Set Rsc=server.CreateObject("adodb.recordset") Rsc.Open Sqlc,Conn,1,1 TempStr="" If Rsc.Eof and Rsc.Bof Then TempStr=TempStr & "" Else Do while not Rsc.Eof TempStr=TempStr & "" Rsc.Movenext Loop End if Rsc.Close Set Rsc=Nothing Response.Write TempStr End sub '================================================== '过程名:Admin_ShowClass_Name '作 用:显示栏目名称 '参 数:ChannelID ------频道ID '参 数:ClassID ------栏目ID '================================================== Sub Admin_ShowClass_Name(ChannelID,ClassID) Dim SqlC,RsC,TempStr ChannelID=Clng(ChannelID) ClassID=Clng(ClassID) Sqlc ="Select top 1 ClassName from PE_Class Where ChannelID=" & ChannelID & " and ClassID=" & ClassID Set RsC=server.CreateObject("adodb.recordset") RsC.Open SqlC,Conn,1,1 If RsC.Eof And RsC.Bof Then TempStr="无指定栏目" Else TempStr=RsC("ClassName") End if RsC.Close Set RsC=Nothing Response.Write TempStr End Sub '================================================== '过程名:Admin_ShowSpecial_Name '作 用:显示专题名称 '参 数:ChannelID ------频道ID '参 数:SpecialID ------专题ID '================================================== Sub Admin_ShowSpecial_Name(ChannelID,SpecialID) Dim Sqlc,Rsc,TempStr ChannelID=Clng(ChannelID) SpecialID=Clng(SpecialID) Sqlc ="select top 1 SpecialName from PE_Special Where ChannelID=" & ChannelID & " and SpecialID=" & SpecialID Set Rsc=server.CreateObject("adodb.recordset") Rsc.open Sqlc,Conn,1,1 If Rsc.Eof and Rsc.Bof then TempStr="无指定专题" Else TempStr=Rsc("SpecialName") End if Rsc.Close Set Rsc=Nothing Response.Write TempStr End Sub '================================================== '过程名:Admin_ShowClass_Option '作 用:显示栏目选项 '参 数:ChannelID ------频道ID '参 数:ClassID ------栏目ID '================================================== sub Admin_ShowClass_Option(ChannelID,ClassID) dim rsClass,sqlClass,strTempC,tmpDepth,i dim arrShowLine(20) ChannelID=Clng(ChannelID) ClassID=Clng(ClassID) for i=0 to ubound(arrShowLine) arrShowLine(i)=False next StrTempC="" sqlClass="Select * From PE_Class where channelid="& ChannelID & " order by RootID,OrderID" set rsClass=conn.execute(sqlClass) if rsClass.bof and rsClass.eof then strTempC="" else do while not rsClass.eof tmpDepth=rsClass("Depth") if rsClass("NextID")>0 then arrShowLine(tmpDepth)=True else arrShowLine(tmpDepth)=False end if strTempC=StrTempC & "" sqlTemplate="select * from PE_Template where TemplateType=" & TemplateType & " And ChannelID=" & ChannelID set rsTemplate=server.CreateObject("adodb.recordset") rsTemplate.open sqlTemplate,conn,1,1 if rsTemplate.bof and rsTemplate.eof then TempStr= TempStr & "" else do while not rsTemplate.eof if rsTemplate("TemplateID")=TemplateID then TempStr= TempStr & "" else TempStr= TempStr & "" end if rsTemplate.movenext loop end if rsTemplate.close set rsTemplate=nothing TempStr= TempStr & "" Response.Write TempStr end sub '================================================== '过程名:Admin_ShowItem_Name '作 用:显示项目名称 '参 数:ItemID ------项目ID '================================================== Sub Admin_ShowItem_Name(ItemID) Dim Sqlc,Rsc,TempStr ItemID=Clng(ItemID) Sqlc ="select top 1 ItemName from Item Where ItemID=" & ItemID Set Rsc=server.CreateObject("adodb.recordset") Rsc.open Sqlc,ConnItem,1,1 If Rsc.Eof and Rsc.Bof then TempStr="无指定项目" Else TempStr=Rsc("ItemName") End if Rsc.Close Set Rsc=Nothing Response.Write TempStr End Sub '================================================== '过程名:Admin_ShowItem_Option '作 用:显示项目选项 '参 数:ItemID ------项目ID '================================================== Sub Admin_ShowItem_Option(ItemID) Dim SqlI,RsI,TempStr ItemID=Clng(ItemID) SqlI ="select ItemID,ItemName from Item order by ItemID desc" Set RsI=server.CreateObject("adodb.recordset") RsI.Open SqlI,ConnItem,1,1 TempStr="" Response.Write TempStr End sub '================================================== '函数名:GetHttpPage // '作 用:获取网页源码 '参 数:HttpUrl ------网页地址 '================================================== Function GetHttpPage(HttpUrl) If IsNull(HttpUrl)=True Or Len(HttpUrl)<18 Or HttpUrl="$False$" Then GetHttpPage="$False$" Exit Function End If Dim Http Set Http=server.createobject("MSXML2.XMLHTTP") Http.open "GET",HttpUrl,False Http.Send() If Http.Readystate<>4 then Set Http=Nothing GetHttpPage="$False$" Exit function End if GetHTTPPage=bytesToBSTR(Http.responseBody,"GB2312") Set Http=Nothing If Err.number<>0 then Err.Clear End If End Function '================================================== '函数名:GetHttpPage // '作 用:获取网页源码 '参 数:HttpUrl ------网页地址 '================================================== Function GetHttpPageutf(HttpUrl) If IsNull(HttpUrl)=True Or Len(HttpUrl)<18 Or HttpUrl="$False$" Then GetHttpPageutf="$False$" Exit Function End If Dim Http Set Http=server.createobject("MSXML2.XMLHTTP") Http.open "GET",HttpUrl,False Http.Send() If Http.Readystate<>4 then Set Http=Nothing GetHttpPageutf="$False$" Exit function End if GetHttpPageutf=bytesToBSTRutf(Http.responseBody,"UTF-8") //UTF2GB Set Http=Nothing If Err.number<>0 then Err.Clear End If End Function rem ***************************************************** rem 函数名:InterceptString rem 作 用:截字符串,汉字一个算两个字符,英文算一个字符 rem 参 数:txt ----原字符串 rem 参 数:length ----截取长度 rem 返回值:截取后的字符串 rem ***************************************************** rem ************************************************ BEGIN Function InterceptString(txt,length) txt=trim(txt) x = len(txt) y = 0 if x >= 1 then for ii = 1 to x if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then '如果是汉字 y = y + 2 else y = y + 1 end if if y >= length then txt = left(trim(txt),ii) '字符串限长 exit for end if next InterceptString = txt else InterceptString = "" end if End Function '================================================== '函数名:BytesToBstr '作 用:将获取的源码转换为中文 '参 数:Body ------要转换的变量 '参 数:Cset ------要转换的类型 '================================================== Function BytesToBstr(Body,Cset) Dim Objstream Set Objstream = Server.CreateObject("adodb.stream") objstream.Type = 1 objstream.Mode =3 objstream.Open objstream.Write body objstream.Position = 0 objstream.Type = 2 objstream.Charset = Cset BytesToBstr = objstream.ReadText objstream.Close set objstream = nothing End Function '================================================== '函数名:BytesToBstr '作 用:将获取的源码转换为中文 '参 数:Body ------要转换的变量 '参 数:Cset ------要转换的类型 '================================================== Function BytesToBstrUTF(Body,Cset) Dim Objstream Set Objstream = Server.CreateObject("adodb.stream") objstream.Type = 1 objstream.Mode =3 objstream.Open objstream.Write body objstream.Position = 0 objstream.Type = 2 objstream.Charset = "UTF-8" BytesToBstrUTF = objstream.ReadText objstream.Close set objstream = nothing End Function '================================================== '函数名:PostHttpPage '作 用:登录 '================================================== Function PostHttpPage(RefererUrl,PostUrl,PostData) Dim xmlHttp Dim RetStr Set xmlHttp = CreateObject("Msxml2.XMLHTTP") xmlHttp.Open "POST", PostUrl, False XmlHTTP.setRequestHeader "Content-Length",Len(PostData) xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" xmlHttp.setRequestHeader "Referer", RefererUrl xmlHttp.Send PostData If Err.Number <> 0 Then Set xmlHttp=Nothing PostHttpPage = "$False$" Exit Function End If PostHttpPage=bytesToBSTR(xmlHttp.responseBody,"GB2312") Set xmlHttp = nothing End Function '================================================== '函数名:UrlEncoding '作 用:转换编码 '================================================== Function UrlEncoding(DataStr) Dim StrReturn,Si,ThisChr,InnerCode,Hight8,Low8 StrReturn = "" For Si = 1 To Len(DataStr) ThisChr = Mid(DataStr,Si,1) If Abs(Asc(ThisChr)) < &HFF Then StrReturn = StrReturn & ThisChr Else InnerCode = Asc(ThisChr) If InnerCode < 0 Then InnerCode = InnerCode + &H10000 End If Hight8 = (InnerCode And &HFF00)\ &HFF Low8 = InnerCode And &HFF StrReturn = StrReturn & "%" & Hex(Hight8) & "%" & Hex(Low8) End If Next UrlEncoding = StrReturn End Function '================================================== '函数名:GetBody // '作 用:截取字符串 '参 数:ConStr ------将要截取的字符串 '参 数:StartStr ------开始字符串 '参 数:OverStr ------结束字符串 '参 数:IncluL ------是否包含StartStr '参 数:IncluR ------是否包含OverStr '================================================== Function GetBody(ConStr,StartStr,OverStr,IncluL,IncluR) If ConStr="$False$" or ConStr="" or IsNull(ConStr)=True Or StartStr="" or IsNull(StartStr)=True Or OverStr="" or IsNull(OverStr)=True Then GetBody="$False$" Exit Function End If Dim ConStrTemp Dim Start,Over ConStrTemp=Lcase(ConStr) StartStr=Lcase(StartStr) OverStr=Lcase(OverStr) Start = InStrB(1, ConStrTemp, StartStr, vbBinaryCompare) If Start<=0 then GetBody="$False$" Exit Function Else If IncluL=False Then Start=Start+LenB(StartStr) End If End If Over=InStrB(Start,ConStrTemp,OverStr,vbBinaryCompare) If Over<=0 Or Over<=Start then GetBody="$False$" Exit Function Else If IncluR=True Then Over=Over+LenB(OverStr) End If End If GetBody=MidB(ConStr,Start,Over-Start) End Function '================================================== '函数名:GetArray '作 用:提取链接地址,以$Array$分隔 '参 数:ConStr ------提取地址的原字符 '参 数:StartStr ------开始字符串 '参 数:OverStr ------结束字符串 '参 数:IncluL ------是否包含StartStr '参 数:IncluR ------是否包含OverStr '================================================== Function GetArray(Byval ConStr,StartStr,OverStr,IncluL,IncluR) If ConStr="$False$" or ConStr="" Or IsNull(ConStr)=True or StartStr="" Or OverStr="" or IsNull(StartStr)=True Or IsNull(OverStr)=True Then GetArray="$False$" Exit Function End If Dim TempStr,TempStr2,objRegExp,Matches,Match TempStr="" Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.Pattern = "("&StartStr&").+?("&OverStr&")" Set Matches =objRegExp.Execute(ConStr) For Each Match in Matches TempStr=TempStr & "$Array$" & Match.Value Next Set Matches=nothing If TempStr="" Then GetArray="$False$" Exit Function End If TempStr=Right(TempStr,Len(TempStr)-7) If IncluL=False then objRegExp.Pattern =StartStr TempStr=objRegExp.Replace(TempStr,"") End if If IncluR=False then objRegExp.Pattern =OverStr TempStr=objRegExp.Replace(TempStr,"") End if Set objRegExp=nothing Set Matches=nothing TempStr=Replace(TempStr,"""","") TempStr=Replace(TempStr,"'","") TempStr=Replace(TempStr," ","") TempStr=Replace(TempStr,"(","") TempStr=Replace(TempStr,")","") If TempStr="" then GetArray="$False$" Else GetArray=TempStr End if End Function '================================================== '函数名:DefiniteUrl '作 用:将相对地址转换为绝对地址 '参 数:PrimitiveUrl ------要转换的相对地址 '参 数:ConsultUrl ------当前网页地址 '================================================== Function DefiniteUrl(Byval PrimitiveUrl,Byval ConsultUrl) Dim ConTemp,PriTemp,Pi,Ci,PriArray,ConArray If PrimitiveUrl="" or ConsultUrl="" or PrimitiveUrl="$False$" or ConsultUrl="$False$" Then DefiniteUrl="$False$" Exit Function End If If Left(Lcase(ConsultUrl),7)<>"http://" Then ConsultUrl= "http://" & ConsultUrl End If ConsultUrl=Replace(ConsultUrl,"\","/") ConsultUrl=Replace(ConsultUrl,"://",":\\") PrimitiveUrl=Replace(PrimitiveUrl,"\","/") If Right(ConsultUrl,1)<>"/" Then If Instr(ConsultUrl,"/")>0 Then If Instr(Right(ConsultUrl,Len(ConsultUrl)-InstrRev(ConsultUrl,"/")),".")>0 then Else ConsultUrl=ConsultUrl & "/" End If Else ConsultUrl=ConsultUrl & "/" End If End If ConArray=Split(ConsultUrl,"/") If Left(LCase(PrimitiveUrl),7) = "http://" then DefiniteUrl=Replace(PrimitiveUrl,"://",":\\") ElseIf Left(PrimitiveUrl,1) = "/" Then DefiniteUrl=ConArray(0) & PrimitiveUrl ElseIf Left(PrimitiveUrl,2)="./" Then PrimitiveUrl=Right(PrimitiveUrl,Len(PrimitiveUrl)-2) If Right(ConsultUrl,1)="/" Then DefiniteUrl=ConsultUrl & PrimitiveUrl Else DefiniteUrl=Left(ConsultUrl,InstrRev(ConsultUrl,"/")) & PrimitiveUrl End If ElseIf Left(PrimitiveUrl,3)="../" then Do While Left(PrimitiveUrl,3)="../" PrimitiveUrl=Right(PrimitiveUrl,Len(PrimitiveUrl)-3) Pi=Pi+1 Loop For Ci=0 to (Ubound(ConArray)-1-Pi) If DefiniteUrl<>"" Then DefiniteUrl=DefiniteUrl & "/" & ConArray(Ci) Else DefiniteUrl=ConArray(Ci) End If Next DefiniteUrl=DefiniteUrl & "/" & PrimitiveUrl Else If Instr(PrimitiveUrl,"/")>0 Then PriArray=Split(PrimitiveUrl,"/") If Instr(PriArray(0),".")>0 Then If Right(PrimitiveUrl,1)="/" Then DefiniteUrl="http:\\" & PrimitiveUrl Else If Instr(PriArray(Ubound(PriArray)-1),".")>0 Then DefiniteUrl="http:\\" & PrimitiveUrl Else DefiniteUrl="http:\\" & PrimitiveUrl & "/" End If End If Else If Right(ConsultUrl,1)="/" Then DefiniteUrl=ConsultUrl & PrimitiveUrl Else DefiniteUrl=Left(ConsultUrl,InstrRev(ConsultUrl,"/")) & PrimitiveUrl End If End If Else If Instr(PrimitiveUrl,".")>0 Then If Right(ConsultUrl,1)="/" Then If right(LCase(PrimitiveUrl),3)=".cn" or right(LCase(PrimitiveUrl),3)="com" or right(LCase(PrimitiveUrl),3)="net" or right(LCase(PrimitiveUrl),3)="org" Then DefiniteUrl="http:\\" & PrimitiveUrl & "/" Else DefiniteUrl=ConsultUrl & PrimitiveUrl End If Else If right(LCase(PrimitiveUrl),3)=".cn" or right(LCase(PrimitiveUrl),3)="com" or right(LCase(PrimitiveUrl),3)="net" or right(LCase(PrimitiveUrl),3)="org" Then DefiniteUrl="http:\\" & PrimitiveUrl & "/" Else DefiniteUrl=Left(ConsultUrl,InstrRev(ConsultUrl,"/")) & "/" & PrimitiveUrl End If End If Else If Right(ConsultUrl,1)="/" Then DefiniteUrl=ConsultUrl & PrimitiveUrl & "/" Else DefiniteUrl=Left(ConsultUrl,InstrRev(ConsultUrl,"/")) & "/" & PrimitiveUrl & "/" End If End If End If End If If Left(DefiniteUrl,1)="/" then DefiniteUrl=Right(DefiniteUrl,Len(DefiniteUrl)-1) End if If DefiniteUrl<>"" Then DefiniteUrl=Replace(DefiniteUrl,"//","/") DefiniteUrl=Replace(DefiniteUrl,":\\","://") Else DefiniteUrl="$False$" End If End Function '================================================== '函数名:ReplaceSaveRemoteFile // '作 用:替换、保存远程图片 '参 数:ConStr ------ 要替换的字符串 '参 数:SaveTf ------ 是否保存文件,False不保存,True保存 '参 数: TistUrl------ 当前网页地址 '================================================== Function ReplaceSaveRemoteFile(ConStr,strInstallDir,strChannelDir,SaveTf,TistUrl) If ConStr="$False$" or ConStr="" or strInstallDir="" or strChannelDir="" Then ReplaceSaveRemoteFile=ConStr Exit Function End If Dim TempStr,TempStr2,TempStr3,Re,Matches,Match,Tempi,TempArray,TempArray2 Set Re = New Regexp Re.IgnoreCase = True Re.Global = True Re.Pattern ="]>" Set Matches =Re.Execute(ConStr) For Each Match in Matches If TempStr<>"" then TempStr=TempStr & "$Array$" & Match.Value Else TempStr=Match.Value End if Next If TempStr<>"" Then TempArray=Split(TempStr,"$Array$") TempStr="" For Tempi=0 To Ubound(TempArray) Re.Pattern ="src\s*=\s*.+?\.(gif|jpg|bmp|jpeg|psd|png|svg|dxf|wmf|tiff)" Set Matches =Re.Execute(TempArray(Tempi)) For Each Match in Matches If TempStr<>"" then TempStr=TempStr & "$Array$" & Match.Value Else TempStr=Match.Value End if Next Next End if If TempStr<>"" Then Re.Pattern ="src\s*=\s*" TempStr=Re.Replace(TempStr,"") End If Set Matches=nothing Set Re=nothing If TempStr="" or IsNull(TempStr)=True Then ReplaceSaveRemoteFile=ConStr Exit function End if TempStr=Replace(TempStr,"""","") TempStr=Replace(TempStr,"'","") TempStr=Replace(TempStr," ","") Dim RemoteFileurl,SavePath,PathTemp,DtNow,strFileName,strFileType,ArrSaveFileName,RanNum,Arr_Path DtNow=Now() If SaveTf=True then '*********************************** SavePath= strChannelDir & "/" & year(DtNow) & right("0" & month(DtNow),2) & right("0" & day(DtNow),2) &"/" 'response.write Server.MapPath(SavePath) 'response.write SavePath 'response.end SavePath=Server.MapPath(SavePath)&"/" response.write "链接路径:" & savepath & "
" Arr_Path=Split(SavePath,"/") PathTemp="" For Tempi=0 To Ubound(Arr_Path) If Tempi=0 Then PathTemp=Arr_Path(0) & "/" ElseIf Tempi=Ubound(Arr_Path) Then Exit For Else PathTemp=PathTemp & Arr_Path(Tempi) & "/" End If If CheckDir(PathTemp)=False Then If MakeNewsDir(PathTemp)=False Then SaveTf=False Exit For End If End If Next End If 'response.write checkdir("/news_pic/news_pic/20140208/") 'response.end '去掉重复图片开始 TempArray=Split(TempStr,"$Array$") TempStr="" For Tempi=0 To Ubound(TempArray) If Instr(Lcase(TempStr),Lcase(TempArray(Tempi)))<1 Then TempStr=TempStr & "$Array$" & TempArray(Tempi) End If Next TempStr=Right(TempStr,Len(TempStr)-7) TempArray=Split(TempStr,"$Array$") '去掉重复图片结束 '转换相对图片地址开始 TempStr="" For Tempi=0 To Ubound(TempArray) TempStr=TempStr & "$Array$" & DefiniteUrl(TempArray(Tempi),TistUrl) Next TempStr=Right(TempStr,Len(TempStr)-7) TempStr=Replace(TempStr,Chr(0),"") TempArray2=Split(TempStr,"$Array$") TempStr="" '转换相对图片地址结束 '图片替换/保存 Set Re = New Regexp Re.IgnoreCase = True Re.Global = True For Tempi=0 To Ubound(TempArray2) RemoteFileUrl=TempArray2(Tempi) 'response.write RemoteFileUrl 'response.end If RemoteFileUrl<>"$False$" And SaveTf=True Then'保存图片 ArrSaveFileName = Split(RemoteFileurl,".") strFileType=Lcase(ArrSaveFileName(Ubound(ArrSaveFileName)))'文件类型 If strFileType="asp" or strFileType="asa" or strFileType="aspx" or strFileType="cer" or strFileType="cdx" or strFileType="exe" or strFileType="rar" or strFileType="zip" then UploadFiles="" ReplaceSaveRemoteFile=ConStr Exit Function End If Randomize RanNum=Int(900*Rnd)+100 strFileName = year(DtNow) & right("0" & month(DtNow),2) & right("0" & day(DtNow),2) & right("0" & hour(DtNow),2) & right("0" & minute(DtNow),2) & right("0" & second(DtNow),2) & ranNum & "." & strFileType Re.Pattern =TempArray(Tempi) If SaveRemoteFile(SavePath & strFileName,RemoteFileUrl)=True Then '******************************** 'response.write SavePath & strFileName 'response.end PathTemp=SavePath & strFileName ConStr=Re.Replace(ConStr,PathTemp) Re.Pattern=strInstallDir & strChannelDir & "/" UploadFiles=UploadFiles & "|" & Re.Replace(SavePath &strFileName,"") Else PathTemp=RemoteFileUrl ConStr=Re.Replace(ConStr,PathTemp) 'UploadFiles=UploadFiles & "|" & RemoteFileUrl End If ElseIf RemoteFileurl<>"$False$" and SaveTf=False Then'不保存图片 Re.Pattern =TempArray(Tempi) ConStr=Re.Replace(ConStr,RemoteFileUrl) UploadFiles=UploadFiles & "|" & RemoteFileUrl End If Next Set Re=nothing If UploadFiles<>"" Then UploadFiles=Right(UploadFiles,Len(UploadFiles)-1) End If ReplaceSaveRemoteFile=ConStr End function '================================================== '函数名:ReplaceSwfFile '作 用:解析动画路径 '参 数:ConStr ------ 要替换的字符串 '参 数: TistUrl------ 当前网页地址 '================================================== Function ReplaceSwfFile(ConStr,TistUrl) If ConStr="$False$" or ConStr="" or TistUrl="" or TistUrl="$False$" Then ReplaceSwfFile=ConStr Exit Function End If Dim TempStr,TempStr2,TempStr3,Re,Matches,Match,Tempi,TempArray,TempArray2 Set Re = New Regexp Re.IgnoreCase = True Re.Global = True Re.Pattern ="]>" Set Matches =Re.Execute(ConStr) For Each Match in Matches If TempStr<>"" then TempStr=TempStr & "$Array$" & Match.Value Else TempStr=Match.Value End if Next If TempStr<>"" Then TempArray=Split(TempStr,"$Array$") TempStr="" For Tempi=0 To Ubound(TempArray) Re.Pattern ="value\s*=\s*.+?\.swf" Set Matches =Re.Execute(TempArray(Tempi)) For Each Match in Matches If TempStr<>"" then TempStr=TempStr & "$Array$" & Match.Value Else TempStr=Match.Value End if Next Next End if If TempStr<>"" Then Re.Pattern ="value\s*=\s*" TempStr=Re.Replace(TempStr,"") End If If TempStr="" or IsNull(TempStr)=True Then ReplaceSwfFile=ConStr Exit function End if TempStr=Replace(TempStr,"""","") TempStr=Replace(TempStr,"'","") TempStr=Replace(TempStr," ","") Set Matches=nothing Set Re=nothing '去掉重复文件开始 TempArray=Split(TempStr,"$Array$") TempStr="" For Tempi=0 To Ubound(TempArray) If Instr(Lcase(TempStr),Lcase(TempArray(Tempi)))<1 Then TempStr=TempStr & "$Array$" & TempArray(Tempi) End If Next TempStr=Right(TempStr,Len(TempStr)-7) TempArray=Split(TempStr,"$Array$") '去掉重复文件结束 '转换相对地址开始 TempStr="" For Tempi=0 To Ubound(TempArray) TempStr=TempStr & "$Array$" & DefiniteUrl(TempArray(Tempi),TistUrl) Next TempStr=Right(TempStr,Len(TempStr)-7) TempStr=Replace(TempStr,Chr(0),"") TempArray2=Split(TempStr,"$Array$") TempStr="" '转换相对地址结束 '替换 Set Re = New Regexp Re.IgnoreCase = True Re.Global = True For Tempi=0 To Ubound(TempArray2) RemoteFileUrl=TempArray2(Tempi) Re.Pattern =TempArray(Tempi) ConStr=Re.Replace(ConStr,RemoteFileUrl) Next Set Re=nothing ReplaceSwfFile=ConStr End function '================================================== '过程名:SaveRemoteFile '作 用:保存远程的文件到本地 '参 数:LocalFileName ------ 本地文件名 '参 数:RemoteFileUrl ------ 远程文件URL '================================================== Function SaveRemoteFile(LocalFileName,RemoteFileUrl) SaveRemoteFile=True dim Ads,Retrieval,GetRemoteData Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP") With Retrieval .Open "Get", RemoteFileUrl, False, "", "" .Send If .Readystate<>4 then SaveRemoteFile=False Exit Function End If GetRemoteData = .ResponseBody End With Set Retrieval = Nothing Set Ads = Server.CreateObject("Adodb.Stream") With Ads .Type = 1 .Open .Write GetRemoteData response.Write "2.请核对提取出的图片:
" response.write "" &LocalFileName& "" 'response.write "=========="&RemoteFileUrl&"========" 'response.end if instr(LocalFileName,".php")>0 or instr(LocalFileName,".asp")>0 or instr(LocalFileName,".jsp")>0 or instr(LocalFileName,".cgi")>0 then exit function end if 'response.write LocalFileName 'response.end .SaveToFile (LocalFileName),2 .Cancel() .Close() End With Set Ads=nothing end Function '================================================== '函数名:FpHtmlEnCode '作 用:标题过滤 '参 数:fString ------字符串 '================================================== Function FpHtmlEnCode(fString) If IsNull(fString)=False or fString<>"" or fString<>"$False$" Then fString=nohtml(fString) ' fString=FilterJS(fString) fString = Replace(fString," "," ") fString = Replace(fString,""","") fString = Replace(fString,"'","") fString = replace(fString, ">", "") fString = replace(fString, "<", "") fString = Replace(fString, CHR(9), " ")'  fString = Replace(fString, CHR(10), "") fString = Replace(fString, CHR(13), "") fString = Replace(fString, CHR(34), "") fString = Replace(fString, CHR(32), " ")'space fString = Replace(fString, CHR(39), "") fString = Replace(fString, CHR(10) & CHR(10),"") fString = Replace(fString, CHR(10)&CHR(13), "") fString=Trim(fString) FpHtmlEnCode=fString Else FpHtmlEnCode="$False$" End If End Function '================================================== '函数名:GetPaing '作 用:获取分页 '================================================== Function GetPaing(Byval ConStr,StartStr,OverStr,IncluL,IncluR) If ConStr="$False$" or ConStr="" Or StartStr="" Or OverStr="" or IsNull(ConStr)=True or IsNull(StartStr)=True Or IsNull(OverStr)=True Then GetPaing="$False$" Exit Function End If Dim Start,Over,ConTemp,TempStr TempStr=LCase(ConStr) StartStr=LCase(StartStr) OverStr=LCase(OverStr) Over=Instr(1,TempStr,OverStr) If Over<=0 Then GetPaing="$False$" Exit Function Else If IncluR=True Then Over=Over+Len(OverStr) End If End If TempStr=Mid(TempStr,1,Over) Start=InstrRev(TempStr,StartStr) If IncluL=False Then Start=Start+Len(StartStr) End If If Start<=0 Or Start>=Over Then GetPaing="$False$" Exit Function End If ConTemp=Mid(ConStr,Start,Over-Start) ConTemp=Trim(ConTemp) ConTemp=Replace(ConTemp," ","") ConTemp=Replace(ConTemp,",","") ConTemp=Replace(ConTemp,"'","") ConTemp=Replace(ConTemp,"""","") ConTemp=Replace(ConTemp,">","") ConTemp=Replace(ConTemp,"<","") ConTemp=Replace(ConTemp," ","") GetPaing=ConTemp End Function '================================================== '函数名:ScriptHtml '作 用:过滤html标记 '参 数:ConStr ------ 要过滤的字符串 '================================================== Function ScriptHtml(Byval ConStr,TagName,FType) Dim Re Set Re=new RegExp Re.IgnoreCase =true Re.Global=True Select Case FType Case 1 Re.Pattern="<" & TagName & "([^>])*>" ConStr=Re.Replace(ConStr,"") Case 2 Re.Pattern="<" & TagName & "([^>])*>.*?])*>" ConStr=Re.Replace(ConStr,"") Case 3 Re.Pattern="<" & TagName & "([^>])*>" ConStr=Re.Replace(ConStr,"") Re.Pattern="])*>" ConStr=Re.Replace(ConStr,"") End Select ScriptHtml=ConStr Set Re=Nothing End Function Function CheckDir(byval FolderPath) dim fso Set fso = Server.CreateObject("Scripting.FileSystemObject") If fso.FolderExists(folderpath) then '存在 CheckDir = True Else '不存在 CheckDir = False End if Set fso = nothing End Function Function MakeNewsDir(byval foldername) dim fso Set fso = Server.CreateObject("Scripting.FileSystemObject") 'response.write foldername 'response.end fso.CreateFolder(foldername) If fso.FolderExists(foldername) Then MakeNewsDir = True Else MakeNewsDir = False End If Set fso = nothing End Function '************************************************** '函数名:IsObjInstalled '作 用:检查组件是否已经安装 '参 数:strClassString ----组件名 '返回值:True ----已经安装 ' False ----没有安装 '************************************************** Function IsObjInstalled(strClassString) IsObjInstalled = False Err = 0 Dim xTestObj Set xTestObj = Server.CreateObject(strClassString) If 0 = Err Then IsObjInstalled = True Set xTestObj = Nothing Err = 0 End Function '************************************************** '过程名:WriteErrMsg '作 用:显示错误提示信息 '参 数:无 '************************************************** sub WriteErrMsg(ErrMsg) dim strErr strErr=strErr & "错误信息" & vbcrlf strErr=strErr & "

" & vbcrlf strErr=strErr & "" & vbcrlf strErr=strErr & " " & vbcrlf strErr=strErr & " " & vbcrlf strErr=strErr & " " & vbcrlf strErr=strErr & "
错误信息
产生错误的可能原因:" & ErrMsg &"
<< 返回上一页
" & vbcrlf strErr=strErr & "" & vbcrlf response.write strErr end sub '************************************************** '过程名:WriteSucced '作 用:显示成功提示信息 '参 数:无 '************************************************** sub WriteSucced(ErrMsg) dim strErr strErr=strErr & "成功信息" & vbcrlf strErr=strErr & "

" & vbcrlf strErr=strErr & "" & vbcrlf strErr=strErr & " " & vbcrlf strErr=strErr & " " & vbcrlf 'strErr=strErr & " " & vbcrlf strErr=strErr & "
恭喜你!
" & ErrMsg &"
<< 返回上一页
" & vbcrlf strErr=strErr & "" & vbcrlf response.write strErr end sub '************************************************** '函数名:ShowPage '作 用:显示“上一页 下一页”等信息 '参 数:sFileName ----链接地址 ' TotalNumber ----总数量 ' MaxPerPage ----每页数量 ' ShowTotal ----是否显示总数量 ' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。有某些页面不能使用,否则会出现JS错误。 ' strUnit ----计数单位 '返回值:“上一页 下一页”等信息的HTML代码 '************************************************** function ShowPage(sFileName,TotalNumber,MaxPerPage,ShowTotal,ShowAllPages,strUnit) dim TotalPage,strTemp,strUrl,i if TotalNumber=0 or MaxPerPage=0 or isNull(MaxPerPage) then ShowPage="" exit function end if if totalnumber mod maxperpage=0 then TotalPage= totalnumber \ maxperpage else TotalPage= totalnumber \ maxperpage+1 end if if CurrentPage>TotalPage then CurrentPage=TotalPage strTemp= "
" if ShowTotal=true then strTemp=strTemp & "共 " & totalnumber & " " & strUnit & "  " end if strUrl=JoinChar(sfilename) if CurrentPage<2 then strTemp=strTemp & "首页 上一页 " else strTemp=strTemp & "首页 " strTemp=strTemp & "上一页 " end if if CurrentPage>=TotalPage then strTemp=strTemp & "下一页 尾页" else strTemp=strTemp & "下一页 " strTemp=strTemp & "尾页" end if strTemp=strTemp & " 页次:" & CurrentPage & "/" & TotalPage & "页 " strTemp=strTemp & " " & maxperpage & "" & strUnit & "/页" if ShowAllPages=True then strTemp=strTemp & "  转到第页" end if strTemp=strTemp & "
" ShowPage=strTemp end function '************************************************** '函数名:JoinChar '作 用:向地址中加入 ? 或 & '参 数:strUrl ----网址 '返回值:加了 ? 或 & 的网址 '************************************************** function JoinChar(strUrl) if strUrl="" then JoinChar="" exit function end if if InStr(strUrl,"?")1 then if InStr(strUrl,"&")","") Constr=Replace(Constr,"""","") Constr=Replace(Constr,"?","") Constr=Replace(Constr,"*","") Constr=Replace(Constr,"|","") Constr=Replace(Constr,",","") Constr=Replace(Constr,".","") Constr=Replace(Constr,"/","") Constr=Replace(Constr,"\","") Constr=Replace(Constr,"-","") Constr=Replace(Constr,"@","") Constr=Replace(Constr,"#","") Constr=Replace(Constr,"$","") Constr=Replace(Constr,"%","") Constr=Replace(Constr,"&","") Constr=Replace(Constr,"+","") Constr=Replace(Constr,":","") Constr=Replace(Constr,":","") Constr=Replace(Constr,"‘","") Constr=Replace(Constr,"“","") Constr=Replace(Constr,"”","") Dim i,ConstrTemp For i=1 To Len(Constr) ConstrTemp=ConstrTemp & "|" & Mid(Constr,i,Num) Next If Len(ConstrTemp)<254 Then ConstrTemp=ConstrTemp & "|" Else ConstrTemp=Left(ConstrTemp,254) & "|" End If CreateKeyWord=ConstrTemp End Function Function CheckUrl(strUrl) Dim Re Set Re=new RegExp Re.IgnoreCase =true Re.Global=True Re.Pattern="http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?" If Re.test(strUrl)=True Then CheckUrl=strUrl Else CheckUrl="$False$" End If Set Rs=Nothing End Function '************************************************** '函数名:nohtml '作 用:过滤HTML代码 '参 数:str---需要过滤的原字符串 '返回值:纯中文字符 '************************************************** function nohtml(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="(\<.[^\<]*\>)" str=re.replace(str," ") re.Pattern="(\<\/[^\<]*\>)" str=re.replace(str," ") nohtml=str set re=nothing end function '************************************************** '函数名:Getinfourl '作 用:取得超链的站点域名 '参 数:valuestr---需要过滤的URL '返回值:域名 '************************************************** Function Getinfourl(valuestr) if valuestr<>"" then valuestr=replace(valuestr,"http://","") dim str_numm,str str_numm=len(valuestr) str=right(valuestr,str_numm-instr(valuestr,"/")) valuestr=replace(valuestr,str,"") valuestr=replace(valuestr,"/","") else response.write "该URL为空,转换失败!~请检查!" end if Getinfourl=valuestr end Function function nohref(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="]>" str=re.replace(str," ") re.Pattern="]>" str=re.replace(str," ") nohref=str set re=nothing end Function '-------------------------------------------------------- begin 'UTF-8 To GB2312 function UTF2GB(UTFStr) for Dig=1 to len(UTFStr) if mid(UTFStr,Dig,1)="%" then if len(UTFStr) >= Dig+8 then GBStr=GBStr & ConvChinese(mid(UTFStr,Dig,9)) Dig=Dig+8 else GBStr=GBStr & mid(UTFStr,Dig,1) end if else GBStr=GBStr & mid(UTFStr,Dig,1) end if next UTF2GB=GBStr end function function ConvChinese(x) A=split(mid(x,2),"%") i=0 j=0 for i=0 to ubound(A) A(i)=c16to2(A(i)) next for i=0 to ubound(A)-1 DigS=instr(A(i),"0") Unicode="" for j=1 to DigS-1 if j=1 then A(i)=right(A(i),len(A(i))-DigS) Unicode=Unicode & A(i) else i=i+1 A(i)=right(A(i),len(A(i))-2) Unicode=Unicode & A(i) end if next if len(c2to16(Unicode))=4 then ConvChinese=ConvChinese & chrw(int("&H" & c2to16(Unicode))) else ConvChinese=ConvChinese & chr(int("&H" & c2to16(Unicode))) end if next end function function c2to16(x) i=1 for i=1 to len(x) step 4 c2to16=c2to16 & hex(c2to10(mid(x,i,4))) next end function function c2to10(x) c2to10=0 if x="0" then exit function i=0 for i= 0 to len(x) -1 if mid(x,len(x)-i,1)="1" then c2to10=c2to10+2^(i) next end function function c16to2(x) i=0 for i=1 to len(trim(x)) tempstr= c10to2(cint(int("&h" & mid(x,i,1)))) do while len(tempstr)<4 tempstr="0" & tempstr loop c16to2=c16to2 & tempstr next end function function c10to2(x) mysign=sgn(x) x=abs(x) DigS=1 do if x<2^DigS then exit do else DigS=DigS+1 end if loop tempnum=x i=0 for i=DigS to 1 step-1 if tempnum>=2^(i-1) then tempnum=tempnum-2^(i-1) c10to2=c10to2 & "1" else c10to2=c10to2 & "0" end if next if mysign=-1 then c10to2="-" & c10to2 end Function '----------------------------------------------------- end '------------------------------------ begin '汉字转换为UTF-8 function chinese2unicode(Str) dim i dim Str_one dim Str_unicode for i=1 to len(Str) Str_one=Mid(Str,i,1) Str_unicode=Str_unicode&chr(38) Str_unicode=Str_unicode&chr(35) Str_unicode=Str_unicode&chr(120) Str_unicode=Str_unicode& Hex(ascw(Str_one)) Str_unicode=Str_unicode&chr(59) next Response.Write Str_unicode end function '------------------------------------------- end '================================================== '函数名:ReplaceSaveRemoteFile // '作 用:替换、保存远程图片 '参 数:ConStr ------ 要替换的字符串 '参 数:SaveTf ------ 是否保存文件,False不保存,True保存 '参 数: TistUrl------ 当前网页地址 '================================================== Function ReplaceSaveRemoteFile2(ConStr,strInstallDir,strChannelDir,SaveTf) If ConStr="$False$" or ConStr="" or strInstallDir="" or strChannelDir="" Then ReplaceSaveRemoteFile=ConStr Exit Function End If Dim TempStr,TempStr2,TempStr3,Re,Matches,Match,Tempi,TempArray,TempArray2 Set Re = New Regexp Re.IgnoreCase = True Re.Global = True Re.Pattern ="]>" Set Matches =Re.Execute(ConStr) For Each Match in Matches If TempStr<>"" then TempStr=TempStr & "$Array$" & Match.Value Else TempStr=Match.Value End if Next If TempStr<>"" Then TempArray=Split(TempStr,"$Array$") TempStr="" For Tempi=0 To Ubound(TempArray) Re.Pattern ="src\s*=\s*.+?\.(gif|jpg|bmp|jpeg|psd|png|svg|dxf|wmf|tiff)" Set Matches =Re.Execute(TempArray(Tempi)) For Each Match in Matches If TempStr<>"" then TempStr=TempStr & "$Array$" & Match.Value Else TempStr=Match.Value End if Next Next End if If TempStr<>"" Then Re.Pattern ="src\s*=\s*" TempStr=Re.Replace(TempStr,"") End If Set Matches=nothing Set Re=nothing If TempStr="" or IsNull(TempStr)=True Then ReplaceSaveRemoteFile2=ConStr Exit function End if TempStr=Replace(TempStr,"""","") TempStr=Replace(TempStr,"'","") TempStr=Replace(TempStr," ","") Dim RemoteFileurl,SavePath,PathTemp,DtNow,strFileName,strFileType,ArrSaveFileName,RanNum,Arr_Path DtNow=Now() If SaveTf=True then '*********************************** SavePath= strChannelDir & "/" & year(DtNow) & right("0" & month(DtNow),2) & right("0" & day(DtNow),2) &"/" 'response.write "链接路径:" & savepath & "
" Arr_Path=Split(SavePath,"/") PathTemp="" For Tempi=0 To Ubound(Arr_Path) If Tempi=0 Then PathTemp=Arr_Path(0) & "/" ElseIf Tempi=Ubound(Arr_Path) Then Exit For Else PathTemp=PathTemp & Arr_Path(Tempi) & "/" End If If CheckDir(PathTemp)=False Then If MakeNewsDir(PathTemp)=False Then SaveTf=False Exit For End If End If Next End If '去掉重复图片开始 TempArray=Split(TempStr,"$Array$") TempStr="" For Tempi=0 To Ubound(TempArray) If Instr(Lcase(TempStr),Lcase(TempArray(Tempi)))<1 Then TempStr=TempStr & "$Array$" & TempArray(Tempi) End If Next TempStr=Right(TempStr,Len(TempStr)-7) TempArray=Split(TempStr,"$Array$") '去掉重复图片结束 '转换相对图片地址开始 TempStr="" For Tempi=0 To Ubound(TempArray) TempStr=TempStr & "$Array$" & TempArray(Tempi) Next TempStr=Right(TempStr,Len(TempStr)-7) TempStr=Replace(TempStr,Chr(0),"") TempArray2=Split(TempStr,"$Array$") TempStr="" '转换相对图片地址结束 '图片替换/保存 Set Re = New Regexp Re.IgnoreCase = True Re.Global = True For Tempi=0 To Ubound(TempArray2) RemoteFileUrl=TempArray2(Tempi) if instr(remotefileurl,"/News_pic/2")=0 then If RemoteFileUrl<>"$False$" And SaveTf=True Then'保存图片 ArrSaveFileName = Split(RemoteFileurl,".") strFileType=Lcase(ArrSaveFileName(Ubound(ArrSaveFileName)))'文件类型 If strFileType="asp" or strFileType="asa" or strFileType="aspx" or strFileType="cer" or strFileType="cdx" or strFileType="exe" or strFileType="rar" or strFileType="zip" then UploadFiles="" ReplaceSaveRemoteFile=ConStr Exit Function End If Randomize RanNum=Int(900*Rnd)+100 strFileName = year(DtNow) & right("0" & month(DtNow),2) & right("0" & day(DtNow),2) & right("0" & hour(DtNow),2) & right("0" & minute(DtNow),2) & right("0" & second(DtNow),2) & ranNum & "." & strFileType Re.Pattern =TempArray(Tempi) If SaveRemoteFile(SavePath & strFileName,RemoteFileUrl)=True Then '******************************** PathTemp=SavePath & strFileName ConStr=Re.Replace(ConStr,PathTemp) Re.Pattern=strInstallDir & strChannelDir & "/" UploadFiles=UploadFiles & "|" & Re.Replace(SavePath &strFileName,"") Else PathTemp=RemoteFileUrl ConStr=Re.Replace(ConStr,PathTemp) 'UploadFiles=UploadFiles & "|" & RemoteFileUrl End If ElseIf RemoteFileurl<>"$False$" and SaveTf=False Then'不保存图片 Re.Pattern =TempArray(Tempi) ConStr=Re.Replace(ConStr,RemoteFileUrl) UploadFiles=UploadFiles & "|" & RemoteFileUrl End If end if Next Set Re=nothing If UploadFiles<>"" Then UploadFiles=Right(UploadFiles,Len(UploadFiles)-1) End If ReplaceSaveRemoteFile2=ConStr End function Sub PageControl(iCount,pagecount,page,table_style,font_style) Dim query, a, x, temp action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME") query = Split(Request.ServerVariables("QUERY_STRING"), "&") For Each x In query a = Split(x, "=") If StrComp(a(0), "page", vbTextCompare) <> 0 Then temp = temp & a(0) & "=" & a(1) & "&" End If Next Response.Write("" & vbCrLf ) Response.Write("" & vbCrLf ) Response.Write("" & vbCrLf ) Response.Write("" & vbCrLf ) Response.Write("
" & vbCrLf ) Response.Write(font_style & vbCrLf ) if page<=1 then Response.Write ("首 页 " & vbCrLf) Response.Write ("上一页 " & vbCrLf) else Response.Write("首 页 " & vbCrLf) Response.Write("上一页 " & vbCrLf) end if if page>=pagecount then Response.Write ("下一页 " & vbCrLf) Response.Write ("尾 页 " & vbCrLf) else Response.Write("下一页 " & vbCrLf) Response.Write("尾 页 " & vbCrLf) end if Response.Write(" 页次:" & page & "/" & pageCount & "页" & vbCrLf) Response.Write(" 共有数据" & iCount & "条" & vbCrLf) Response.Write(" 转到" & "" & "页" & vbCrLf & "") Response.Write("
" & vbCrLf ) End Sub Function CopyMyFolder(FolderName,FolderPath) sFolder=FolderName oFolder=FolderPath set fso=server.createobject("scripting.filesystemobject") if fso.folderexists(FolderName) Then'检查原文件夹是否存在 if fso.folderexists(FolderPath) Then'检查目标文件夹是否存在 fso.copyfolder sFolder,oFolder Else '目标文件夹如果不存在就创建 CreateNewFolder = FolderPath fso.CreateFolder(CreateNewFolder) fso.copyfolder sFolder,oFolder End if CopyMyFolder="复制文件夹["&FolderName&"]到["&FolderPath&"]成功!" Else CopyMyFolder="错误,原文件夹["&sFolde&"]不存在!" End If set fso=nothing End Function %> <% on error resume next dim keywords keywords=request("tag") if keywords="" then response.redirect "/" response.end end if %> <%=keywords%>--孕婴知识港
首页 > 关键词:<%=keywords%>
    <% set rs=server.CreateObject("adodb.recordset") sql="select newstitle,newscontent,id,pic,description from news where newstitle like '%"&keywords&"%' or charindex('"&keywords&"',keywords)>0" rs.open sql,conn,1,3 if rs.eof then response.write"
  • 没有您要搜索的记录
  • " else dim iCount,iPageSize,maxpage,page rs.PageSize =10'每页记录条数 iCount=rs.RecordCount '记录总数 iPageSize=rs.PageSize maxpage=rs.PageCount page=request("page") if Not IsNumeric(page) or page="" then page=1 else page=cint(page) end if if page<1 then page=1 elseif page>maxpage then page=maxpage end if rs.AbsolutePage=Page if page=maxpage then x=iCount-(maxpage-1)*iPageSize else x=iPageSize end if For i=1 To x %>
  • .html" target=_blank><%=rs("newstitle")%>

    <% if isnull(rs("description")) or rs("description")="" then response.write left(nohtml(rs("newscontent")),150) else response.write rs("description") end if %> .html" target=_blank>详细>> <%if isnull(rs("pic")) or rs("pic")="" then else response.write "
    " end if %>
  • <% rs.movenext next end if rs.close set rs=nothing %>
")%>

热点关注

    <% set rs=server.createobject("adodb.recordset") redian="" sql="select top 6 newstitle,id from news order by newid()" rs.open sql,conn,1,3 if not rs.eof then do while not rs.eof response.write "
  • "&rs("newstitle")&"
  • " rs.movenext loop end if rs.close %>

母婴热点

<% sql="select top 1 newstitle,newscontent,id,pic from news where bigclassid in (2,4) and (pic is not null and pic<>'')" rs.open sql,conn,1,3 if not rs.eof then hrefa="/content/"&rs("id")&".html" newstitle=rs("newstitle") newscontent=InterceptString(nohtml(rs("newscontent")),70) pic=rs("pic") end if rs.close %>

<%=newstitle%>

<%=newscontent%>..详细]

    <% sql="select top 5 newstitle,id from news where bigclassid in (2,4) order by newid()" rs.open sql,conn,1,3 if not rs.eof then do while not rs.eof response.write "
  • "&rs("newstitle")&"
  • " rs.movenext loop end if rs.close %>

宝贝健康

<% sql="select top 1 newstitle,newscontent,id,pic from news where bigclassid in (3,6) and (pic is not null and pic<>'')" rs.open sql,conn,1,3 if not rs.eof then hrefa="/content/"&rs("id")&".html" newstitle=rs("newstitle") newscontent=InterceptString(nohtml(rs("newscontent")),70) pic=rs("pic") end if rs.close %>

<%=newstitle%>

<%=newscontent%>..详细]

    <% sql="select top 5 newstitle,id from news where bigclassid in (3,6) order by newid()" rs.open sql,conn,1,3 if not rs.eof then do while not rs.eof response.write"
  • "&rs("newstitle")&"
  • " rs.movenext loop end if rs.close %>

玩具中心

<% sql="select top 1 newstitle,newscontent,id,pic from news where pic is not null and pic<>'' order by newid()" rs.open sql,conn,1,3 if not rs.eof then hrefa="/content/"&rs("id")&".html" newstitle=rs("newstitle") newscontent=InterceptString(nohtml(rs("newscontent")),70) pic=rs("pic") end if rs.close %>

<%=newstitle%>

<%=newscontent%>..详细]

    <% sql="select top 5 newstitle,id from news where bigclassid=5 order by newid()" rs.open sql,conn,1,3 if not rs.eof then do while not rs.eof response.write "
  • "&rs("newstitle")&"
  • " rs.movenext loop end if rs.close %>

孕婴知识

<% sql="select top 1 newstitle,newscontent,id,pic from news where bigclassid=1 and (pic is not null and pic<>'')" rs.open sql,conn,1,3 if not rs.eof then hrefa="/content/"&rs("id")&".html" newstitle=rs("newstitle") newscontent=InterceptString(nohtml(rs("newscontent")),70) pic=rs("pic") end if rs.close %>

<%=newstitle%>

<%=newscontent%>..详细]

    <% sql="select top 5 newstitle,id from news where bigclassid=1 order by newid()" rs.open sql,conn,1,3 if not rs.eof then do while not rs.eof response.write "
  • "&rs("newstitle")&"
  • " rs.movenext loop end if rs.close set rs=nothing %>
<%Sub PageControl(iCount,pagecount,page,table_style,font_style) Dim query, a, x, temp action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME") query = Split(Request.ServerVariables("QUERY_STRING"), "&") For Each x In query a = Split(x, "=") If StrComp(a(0), "page", vbTextCompare) <> 0 Then temp = temp & a(0) & "=" & a(1) & "&" End If Next Response.Write("" & vbCrLf ) Response.Write("" & vbCrLf ) Response.Write("" & vbCrLf ) Response.Write("" & vbCrLf ) Response.Write("
" & vbCrLf ) Response.Write(font_style & vbCrLf ) if page<=1 then Response.Write ("首 页 " & vbCrLf) Response.Write ("上一页 " & vbCrLf) else Response.Write("首 页 " & vbCrLf) Response.Write("上一页 " & vbCrLf) end if if page>=pagecount then Response.Write ("下一页 " & vbCrLf) Response.Write ("尾 页 " & vbCrLf) else Response.Write("下一页 " & vbCrLf) Response.Write("尾 页 " & vbCrLf) end if Response.Write(" 页次:" & page & "/" & pageCount & "页" & vbCrLf) Response.Write(" 共有数据" & iCount & "条" & vbCrLf) Response.Write(" 转到" & "" & "页" & vbCrLf & "") Response.Write("
" & vbCrLf ) End Sub %>