<% ''' EYCMS 搜索 ''' ================================================================== eycms.stophack dim sql_where:sql_where="" dim classid:classid=eycms.getint(eycms.fget("classid",0),0) dim key:key=eycms.enhtml(eycms.fget("key",0)) dim keylen:keylen=eycms.strlen(key) dim modeid:modeid=eycms.getint(eycms.fget("modeid",0),0) if instr(key,"请输入") or keylen<=0 then dim errormsg:errormsg="关键字不能为空" end if if keylen<2 then errormsg="关键字不能小于2个字符" end if if keylen>10 then errormsg="关键字不能大于10个字符" end if if errormsg<>"" then eycms.show eycms.getsys("theme_404"),"" eycms.die end if if datatype then sql_where=sql_where&" and (instr(1,lcase(title),lcase('"&key&"'),0)<>0)" else sql_where=sql_where&" and (title like '%"&key&"%')" end if dim classname,catepic dim sonid,parentid,rootid,pagenum pagenum=20 if classid<>0 then dim data:data=eycms.getclassdb(classid) if isarray(data) then sonid=data(5) parentid=data(6) rootid=split(parentid,"]")(0) rootid=replace(rootid,"[","") rootid=CInt(rootid) classname=data(1) catepic=data(15) If catepic="" Then catepic=eycms.get_catepic(rootid) pagenum=data(19) end if sql_where=sql_where&" and classid in("&sonid&")" end if if modeid<>0 then sql_where=sql_where&" and modeid=" & modeid end if eycms.show eycms.getsys("theme_search"),"" if html_page_total<>0 and page=1 then addsearchkey key end if eycms.db.dbclose sub addsearchkey(byval t0) if eycms.loadcookie("search_keyword_"&t0)="" then dim rs set rs=server.createobject("adodb.recordset") rs.open "select title,hits,islock from ey_expand_keyword where title='"&t0&"'",eycms.db.conn,1,3 if rs.eof then rs.addnew rs(0)=t0 rs(1)=1 rs(2)=1 else rs.update rs(1)=rs(1)+1 end if rs.update rs.close set rs=nothing eycms.setcookie "search_keyword_"&t0,t0 end if end sub %>