<% Server.ScriptTimeOut=90 ON ERROR RESUME NEXT dim page,t,dhname,Tname '--------- fwfh=fwwzjc("/inc/fwpbip1.txt","") if fwfh="ER_0" then response.end end if '---------- khdfs=0 if isMobile()=true then khdfs=1 end if '---------- keyword=ltrim(trim(request("keyword"))) wd=ltrim(trim(request("wd"))) if wd<>"" or keyword<>"" then If (Request.QueryString <> "") Then dim lyurl lyurl=Request.QueryString if instr(lyurl,"keyword=")>0 then lyurl=replace(lyurl,"keyword=","wd=") end if response.redirect "/wycd/swjz/swjzso.php?"&lyurl else response.redirect "/wycd/swjz/swjzso.php" End If else response.redirect "/wycd/swjz/" end if response.end page=request("page") if page="" then page=1 end if keyword=request("keyword") keyword=replacestr(request("keyword")) QueryWords= Split( keyword ) if Request("stype")="" then stype=1 else stype=Request("stype") end if if Request("fs")="" then fs="1" else fs=Request("fs") end if Tname=keyword&"_" dhname=" > 搜索“"&keyword&"”" %> <%=Tname%>说文解字_在线查询 <% if khdfs=0 then %> <% else %> <% end if %> <% if khdfs=0 then %> <% else %> <% end if %>
<% if keyword="" then '如果为空 response.write "
  抱歉,您没有输入任何查询数据 !
" else if fs=-2 then strtxt="" else dim ls_shz,ls_hzq1,ls_hzq2,ls_keycd,fsObj,filepath,strtxt set fsObj=server.CreateObject("scripting.filesystemobject") filepath=server.MapPath("swjzksolb/swjzkso1z1.tat") If fsObj.FileExists(filepath) then set txtobj=fsObj.OpenTextFile(filepath,1,false) if txtobj.atendofstream=false then strtxt=txtobj.readall ' strtxt=RegExpTest_soid("{.*?"&keyword&"?.*}",strtxt,keyword) strtxt=RegExpTest_soid("{.*?}",strtxt,keyword) 'strtxt=replace(strtxt,"{","swjzshow.asp?id=") ' strtxt=replace(strtxt,"|",">") ' strtxt=replace(strtxt,"}","") ' response.write strtxt ' response.end ' dim ls_jqcd1 ls_jqcd1=instr(1,strtxt,"|"&keyword&"}") if ls_jqcd1>0 then strtxt=GetContent(strtxt,"{","|",0) ' strtxt=mid(strtxt,1,ls_jqcd1-1) ' ' response.write InstrRev(strtxt,"}{") ' strtxt=mid(strtxt,InstrRev(strtxt,"{")+1) if strtxt<>"" then Set fsObj=nothing Response.Redirect("swjzshow.asp?id="&strtxt) else strtxt="" end if else strtxt="" end if 'response.write strtxt 'response.end else strtxt="" end if Set fsObj=nothing else strtxt="" end if end if end if 'end if if strtxt="" then dim img,j dim action,by,site,sqlzs dim findword,Founderr dim CurrentPage,MaxPerPage,totalPut,totalnumber,Pcount,tempPcount Founderr=false if not isempty(request("page")) then CurrentPage=cint(request("page")) else CurrentPage=1 end if if t="" and keyword<>"" then MaxPerPage =100 else MaxPerPage =300 end if if not isnumeric(request("page")) and request("page")<>"" then Conn.Close Set Conn = Nothing response.write"错误的系统参数!请输入整数" response.end end if sql="" dim tempJoinWord tempJoinWord="" Select case stype case 1 if fs=1 then For i = 0 To UBound( QueryWords ) sql = SQL & tempJoinWord & "(" & _ "zi like '%"&QueryWords(i)&"%')" tempJoinWord = " and " Next else For i = 0 To UBound( QueryWords ) sql = SQL & tempJoinWord & "(" & _ "zi='"&QueryWords(i)&"' )" tempJoinWord = " and " Next end if case 2 if fs=1 then For i = 0 To UBound( QueryWords ) sql = SQL & tempJoinWord & "(" & _ "zi like '%"&QueryWords(i)&"%')" tempJoinWord = " and " Next else For i = 0 To UBound( QueryWords ) sql = SQL & tempJoinWord & "(" & _ "zi='"&QueryWords(i)&"')" tempJoinWord = " and " Next end if case 3 if fs=1 then For i = 0 To UBound( QueryWords ) sql = SQL & tempJoinWord & "(" & _ "zi like '%"&QueryWords(i)&"%')" tempJoinWord = " and " Next else For i = 0 To UBound( QueryWords ) sql = SQL & tempJoinWord & "(" & _ "zi='"&QueryWords(i)&"')" tempJoinWord = " and " Next end if End Select if sql="" then sql="id=99999999999 " end if sqlzs = "SELECT id FROM [swjzk] WHERE " &sql 'response.write sqlzs 'response.end %> <% set rs = server.CreateObject ("adodb.recordset") rs.open sqlzs,conn,1,1 if rs.bof and rs.eof then else totalPut=rs.recordcount '计算出符合条件总数 totalnumber=rs.recordcount '计算出符合条件总数 end if rs.close if CurrentPage=1 then sql="SELECT top "&MaxPerPage&" id,zi FROM [swjzk] WHERE "&sql '总页码为1取当前页 else sqlzs="(select top "&((CurrentPage-1)*MaxPerPage)&" id FROM [swjzk] WHERE "&sql '使用组合查询方式 sql="SELECT top "&MaxPerPage&" id,zi FROM [swjzk] WHERE id>(select max(id) from "&sqlzs&" order by id ) AS T ) and "&sql&" order by id " end if dim ares rs.open sql ,conn,1,1 if rs.bof and rs.eof then redim ares(-1,-1,-1) else ares = rs.GetRows end if rs.close set rs=nothing Conn.Close Set Conn = Nothing dim ls_jlzs ls_jlzs=UBound(ares,2) 'response.write ls_jlzs 'response.end if (ls_jlzs<0 or ls_jlzs="" ) then if keyword="" then response.write "  您没有输入关键字!" else response.write "  抱歉,没有找到与 "&keyword&" 相关的任何内容!" end if else if ls_jlzs=0 then Response.Redirect("swjzshow.asp?id="&stoies(right("0000000"&ares(0,0),7))) end if if (totalPut mod MaxPerPage)=0 then tempPcount= totalPut \ MaxPerPage else tempPcount= totalPut \ MaxPerPage + 1 end if if (totalPut mod MaxPerPage)=0 then Pcount= totalPut \ MaxPerPage else Pcount= totalPut \ MaxPerPage + 1 end if if currentpage > Pcount then currentpage = Pcount if currentpage<1 then currentpage=1 dim bookmark,iia j=(currentpage-1)*MaxPerPage+1 ii=0 response.write "
" showpage() response.write "
" if keyword<>"" then end if response.write "" For iia = 0 To ls_jlzs if keyword<>"" then if j mod 5=0 then response.write ""&ares(1, iia)&"" else response.write ""&ares(1, iia)&"" end if else response.write "您没有输入关键字!" end if j=j+1 next end if erase ares response.write "
" showpage() response.write "
" end if response.write "" sub showpage() dim filename,ii,n filename="swjzso.asp" if totalnumber mod maxperpage=0 then n= totalnumber \ maxperpage else n= totalnumber \ maxperpage+1 end if response.write "
"& vbCrLf if CurrentPage<2 then response.write " 共有词目 "&totalnumber&" 个  首 页  上一页   " else response.write "共有词目 "&totalnumber&" 个  首 页  " response.write "上一页   " end if if n-currentpage<1 then response.write "下一页  尾 页 "& vbCrLf else response.write "下一页" response.write "  尾 页"& vbCrLf end if response.write " 页次:"&CurrentPage&"/"&n&"页 " response.write " "&maxperpage&"个/页 "& vbCrLf ' response.write "转到:" &vbCrLf response.write " 转到: " ' response.write " 
" end sub Function stoies(str) dim mz,t, a,a1,a2,a3,b,x mz="e,b,d,c,e,8,9,7,6,5,4,3,2,1,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z" t="" b=split(mz,",") for x=0 to len(str)-1 a=AscW(mid(str,x+1,1)) a1=a Mod 41 a=(a-a1)/41 a2=a Mod 41 a=(a-a2)/41 a3=a mod 41 t=t&b(a3)&b(a2)&b(a1) next a="z" for x=0 to len(t)-1 step 3 if AscW(x)<>"A" then stoies=t Exit Function end if a=a+mid(t,x+1,2) next stoies=a end function 'function ekstos(str) 'dim b 'b="ebdce897654321fghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ" 'dim a1,a2,a3,d,a 'dim t() 'd=1 'if Mid(str,1,1)="z" then 'redim t(fix(len(str)-1)/2) 'a= UBound(t) 'dim x 'for x=0 to a-1 step 1 'd=d+1 'a2=instr(b,mid(str,d,1)) 'd=d+1 'a3=instr(b,mid(str,d,1)) 't(x)=a2*41+a3 'next 'else 'redim t(fix(len(str)/3)) 'a= UBound(t) 'for x=0 to a-1 step 1 'a1=instr(1,b,mid(str,d,1)) 'd=d+1 'a2=instr(b,mid(str,d,1)) 'd=d+1 'a3=instr(b,mid(str,d,1)) 'd=d+1 't(x)=(a1-1)*1681+(a2-1)*41+(a3-1) 'next 'end if 'dim ra 'ra="" 'for x=0 to a-1 step 1 'ra=ra&chrw(t(x)) 'next 'ekstos=ra 'end function function replacestr(str) str=replace(replace(replace(replace(lcase(trim(str)),"'",""),">",""),"<",""),"chr","") replacestr=replace(replace(replace(str,"%",""),"char",""),"=","") end function Function ReplaceTest(str,patrn, replStr) Dim regEx, str1 ' 建立变量。 str1 = str Set regEx = New RegExp ' 建立正则表达式。 regEx.Pattern = patrn ' 设置模式。 regEx.IgnoreCase = True ' 设置是否区分大小写。 ReplaceTest = regEx.Replace(str1, replStr) ' 作替换。 End Function function replnr(str) dim ih ih=0 For ih = LBound( QueryWords ) to UBound( QueryWords ) str=replaceTest(str,""&QueryWords(ih)&"",""&QueryWords(ih)&"") Next replnr=str end function Function RegExpTest_soid(patrn,strng,sostr) Dim regEx, Match, Matches,f_idh,f_thnr '建立变量。 Set regEx = New RegExp '建立正则表达式。 regEx.Pattern = patrn'设置模式。 regEx.IgnoreCase = True '设置是否区分字符大小写。 regEx.Global = True '设置全局可用性。 Set Matches = regEx.Execute(strng)'执行搜索。 For Each Match in Matches'遍历匹配集合。 if instr(Match.Value,sostr)>0 then ' RetStr = RetStr & "Match found at position " ' RetStr = RetStr & Match.FirstIndex & ". Match Value is '" ' RetStr = RetStr & Match.Value & "'." & "
" f_idh= GetContent(Match.Value,"{","|",0) f_thnr=replace(Match.Value,f_idh,stoies(right("0000000"&f_idh,7))) RetStr=RetStr & f_thnr f_thnr="" 'RetStr=RetStr & f_idh &"
" end if Next RegExpTest_soid = RetStr 'RegExpTest_soid = strng End Function %>