searchfunction_xml.asp
上传用户:rblchem
上传日期:2022-04-27
资源大小:1941k
文件大小:10k
源码类别:

编辑器/阅读器

开发平台:

C#

  1. <%
  2. Function SearchSelectCate(cateid1,cateid2,Action)
  3. If Action="SaveEditSetting" then
  4. If cstr(cateid1)=cstr(cateid2) then
  5. SearchSelectCate="selected"
  6. else
  7.     SearchSelectCate=""
  8. End if
  9. Else
  10. SearchSelectCate=""
  11. End if
  12. End Function
  13. Function SearchSelectChecked(radio1,radio2,Action)
  14. If Action="SaveEditSetting" then
  15. If cstr(radio1)=cstr(radio2) then
  16. SearchSelectChecked="checked=""checked"""
  17. else
  18.     SearchSelectChecked=""
  19. End if
  20. Else
  21. SearchSelectChecked=""
  22. End if
  23. End Function
  24. Function CheckNumeric(Byval CHECK_ID)
  25. If CHECK_ID<>"" and IsNumeric(CHECK_ID) Then _
  26. CHECK_ID = cCur(CHECK_ID) _
  27. Else _
  28. CHECK_ID = 0
  29. CheckNumeric = CHECK_ID
  30. End Function
  31. %>
  32. <%
  33. Sub SearchTable(searchtype,Action)
  34. %>
  35. <tr>
  36. <td height="26">标题包含</td>
  37. <td colspan=5><input name="s_title" type=text id="s_title" size=45 value=""</td>
  38. </tr>
  39. <tr>
  40. <td height="28">分类为</td>
  41. <td colspan=5>
  42. <select name="s_cate" size=1 id="s_cate">
  43. <option value=0 selected>任意</option>
  44. <%
  45. Set conn=ConnectDB()
  46. set RS=conn.execute("SELECT * FROM [Category]")
  47. WHILE NOT RS.EOF%>
  48. <option value="<%=RS("Category_ID")%>"><%=RS("Category_Name")%></option>
  49. <%
  50. RS.MOVENEXT
  51. WEND
  52. RS.CLOSE
  53. SET RS=NOTHING
  54. closedb(conn)
  55. %>
  56. </select>
  57. </td>
  58. </tr>
  59. <tr>
  60.   <td rowspan="3">更新时间</td>
  61.   <td height="22" colspan=5><input name="radiobutton" type="radio" value="1" checked="checked"/>
  62.     任意</td>
  63. </tr>
  64. <tr>
  65.   <td height="26" colspan=5><input name="radiobutton" type="radio" value="2"/>
  66.     没更新过的
  67.   </td>
  68. </tr>
  69. <tr>
  70.   <td height="26" colspan=5>
  71.   <input name="radiobutton" type="radio" value="3"/>
  72.     更新过的</td>
  73. </tr>
  74. <tr>
  75.   <td rowspan="3">审核</td>
  76.   <td height="22" colspan=5><input name="radiobutton1" type="radio" value="1" checked="checked"/>
  77.     任意</td>
  78. </tr>
  79. <tr>
  80.   <td height="26" colspan=5><input name="radiobutton1" type="radio" value="2"/>
  81.     没审核过的
  82.   </td>
  83. </tr>
  84. <tr>
  85.   <td height="26" colspan=5>
  86.   <input name="radiobutton1" type="radio" value="3"/>
  87.     审核过的</td>
  88. </tr>
  89. <tr>
  90.   <td rowspan="3">元素</td>
  91.   <td height="22" colspan=5><input name="radiobutton2" type="radio" value="1" checked="checked"/>
  92.     任意</td>
  93. </tr>
  94. <tr>
  95.   <td height="26" colspan=5><input name="radiobutton2" type="radio" value="2"/>
  96.     没设置过元素的
  97.   </td>
  98. </tr>
  99. <tr>
  100.   <td height="26" colspan=5>
  101.   <input name="radiobutton2" type="radio" value="3"/>
  102.     设置过元素的</td>
  103. </tr>
  104. <tr>
  105. <td height="34"><u>XML_URL包含:</u><br />
  106.  feed地址(唯一标识)</td>
  107. <td colspan=5><input name="s_url" type=text id="s_url" size=45 value=""></td>
  108. </tr>
  109. <tr>
  110. <td height="26"><u>网站地址(site)包含:</u><br />
  111.   隶属于哪个总站<br /></td>
  112. <td colspan=5><input name="s_site" type=text id="s_site" size=45 value=""></td>
  113. </tr>
  114. <tr>
  115.   <td height="26">描述包含</td>
  116.   <td colspan=5><input name="s_description" type=text id="s_description" size=45  value=""/></td>
  117. </tr>
  118. <tr>
  119.   <td height="26">
  120.   每页显示
  121.   </td>
  122.   <td colspan=5><input name="maxperpaage" type="text" id="maxperpaage" size="20"  value=""/>
  123. 条</td>
  124. </tr>
  125. <%
  126. End Sub
  127. Public NewsSql
  128. Sub SearchRequestAction
  129.     If validate_string(Lcase(Request.QueryString))=False then
  130. response.write "Don't try to hack."
  131. Response.end
  132. End If
  133.     Sqlstr=""
  134. If trim(Request("s_title")) <> "" Then
  135.     s_title=CStr(Replace(Request("s_title"),chr(39),chr(39)&chr(39)))
  136. If Sqlstr = "" Then
  137. Sqlstr = " title LIKE '%" & s_title & "%'"
  138. Else
  139. Sqlstr = Sqlstr & " AND title LIKE '%" & s_title & "%'"
  140. End If
  141. End If
  142. If request("radiobutton")<>1 then
  143.         If request("radiobutton")=2 then
  144. If Sqlstr = "" Then
  145. Sqlstr = " isnull(lastupdatetime) "
  146. Else
  147. Sqlstr = Sqlstr & " AND  isnull(lastupdatetime) "
  148. End If
  149. End If
  150. If request("radiobutton")=3 then
  151. If Sqlstr = "" Then
  152. Sqlstr = " not isnull(lastupdatetime) "
  153. Else
  154. Sqlstr = Sqlstr & " AND  not isnull(lastupdatetime) "
  155. End If
  156. End If
  157. End if
  158. If request("radiobutton1")<>1 then
  159.         If request("radiobutton1")=2 then
  160. If Sqlstr = "" Then
  161. Sqlstr = " ShenHe=0 "
  162. Else
  163. Sqlstr = Sqlstr & " AND  ShenHe=0 "
  164. End If
  165. End If
  166. If request("radiobutton1")=3 then
  167. If Sqlstr = "" Then
  168. Sqlstr = " ShenHe=1 "
  169. Else
  170. Sqlstr = Sqlstr & " AND  ShenHe=1 "
  171. End If
  172. End If
  173. End if
  174. If request("radiobutton2")<>1 then
  175.         If request("radiobutton2")=2 then
  176. If Sqlstr = "" Then
  177. Sqlstr = " Elements='' "
  178. Else
  179. Sqlstr = Sqlstr & " AND  Elements='' "
  180. End If
  181. End If
  182. If request("radiobutton2")=3 then
  183. If Sqlstr = "" Then
  184. Sqlstr = " Elements<>'' "
  185. Else
  186. Sqlstr = Sqlstr & " AND  Elements<>'' "
  187. End If
  188. End If
  189. End if
  190. '更新时间审核元素
  191. If trim(URLDecode(Request("s_url"))) <> "" Then
  192.     s_url=CStr(Replace(URLDecode(Request("s_url")),chr(39),chr(39)&chr(39)))
  193. If Sqlstr = "" Then
  194. Sqlstr = " linkxml LIKE '%" & s_url & "%'"
  195. Else
  196. Sqlstr = Sqlstr & " AND linkxml LIKE '%" & s_url & "%'"
  197. End If
  198. End If
  199. If trim(URLDecode(Request("s_site"))) <> "" Then
  200. s_site=CStr(Replace(URLDecode(Request("s_site")),chr(39),chr(39)&chr(39)))
  201. If Sqlstr = "" Then
  202. Sqlstr = " htmlUrl LIKE '%" & s_site & "%'"
  203. Else
  204. Sqlstr = Sqlstr & " AND htmlUrl LIKE '%" & s_site & "%'"
  205. End If
  206. End If
  207. If trim(Request("s_description")) <> "" Then
  208. s_description=CStr(Replace(Request("s_description"),chr(39),chr(39)&chr(39)))
  209. If Sqlstr = "" Then
  210. Sqlstr = " Description LIKE '%" & URLDecode(s_description) & "%'"
  211. Else
  212. Sqlstr = Sqlstr & " AND Description LIKE '%" & URLDecode(s_description) & "%'"
  213. End If
  214. End If
  215. If isempty(Request("s_cate")) then 
  216. s_cate=0
  217. else
  218.        If trim(Request("s_cate"))="" then
  219.         s_cate=0
  220.        else
  221.     s_cate=Request("s_cate")
  222.    end if
  223.     end if
  224.     call CheckParameter(s_cate,"int",0)
  225. If s_cate<>0 Then
  226. If Sqlstr = "" Then
  227. Sqlstr = " LinkXML.Category_id =" & s_cate & " "
  228. Else
  229. Sqlstr = Sqlstr & " AND LinkXML.Category_id =" & s_cate & " "
  230. End If
  231. End If
  232. If trim(request("shenhesql"))<>"" then
  233. if Sqlstr<>"" then
  234. conn.execute ("update [linkxml] set [shenhe]=1 where " & Sqlstr &" ")
  235. response.write "通过审核成功"
  236. response.end
  237. else
  238. conn.execute("update [linkxml] set [shenhe]=1")
  239. response.write "通过审核成功"
  240. response.end
  241. end if
  242. elseif trim(request("NotShenHeSql"))<>"" then
  243.     if Sqlstr<>"" then
  244. conn.execute ("update [linkxml] set [shenhe]=0 where " & Sqlstr &" ")
  245. response.write "不通过审核成功"
  246. response.end
  247. else
  248. conn.execute("update [linkxml] set [shenhe]=0")
  249. response.write "不通过审核成功"
  250. response.end
  251. end if
  252. elseif trim(request("ViewSql"))<>"" then
  253.     
  254.     if Sqlstr<>"" then
  255. conn.execute ("update [linkxml] set [other]='Y' where " & Sqlstr &" ")
  256. response.write "显示成功"
  257. Application.Lock
  258. Application(SessionStr&"SXNAindex")=empty
  259.         Application(SessionStr&"SXNAintPageCount")=empty
  260. Application.unlock
  261. response.end
  262. else
  263. conn.execute("update [linkxml] set [other]='Y'")
  264. response.write "显示成功"
  265. Application.Lock
  266. Application(SessionStr&"SXNAindex")=empty
  267.         Application(SessionStr&"SXNAintPageCount")=empty
  268. Application.unlock
  269. response.end
  270. end if
  271. elseif trim(request("NotViewSql"))<>"" then
  272.     if Sqlstr<>"" then
  273. conn.execute ("update [linkxml] set [other]='N' where " & Sqlstr &" ")
  274. response.write "不显示成功"
  275. Application.Lock
  276. Application(SessionStr&"SXNAindex")=empty
  277.         Application(SessionStr&"SXNAintPageCount")=empty
  278. Application.unlock
  279. response.end
  280. else
  281. conn.execute("update [linkxml] set [other]='N'")
  282. response.write "不显示成功"
  283. Application.Lock
  284. Application(SessionStr&"SXNAindex")=empty
  285.         Application(SessionStr&"SXNAintPageCount")=empty
  286. Application.unlock
  287. response.end
  288. end if
  289. Else
  290. if Sqlstr<>"" then
  291. sql="SELECT * FROM [LinkXML] INNER JOIN [Category] ON LinkXML.Category_id = Category.Category_id WHERE " & Sqlstr & " order by Linkxml.Category_id desc"
  292. else
  293. sql="SELECT * FROM [LinkXML] INNER JOIN [Category] ON LinkXML.Category_id = Category.Category_id order by Linkxml.Category_id desc"
  294. end if
  295. End IF
  296. NewsSql = sql
  297. End Sub
  298. %>
  299. <%
  300. Function OutPutSearchValue(searchtype,default)
  301. if searchtype=1 then
  302. OutPutSearchValue=Node.getAttribute(default)
  303. elseif searchtype=0 and default="maxperpaage" then
  304. OutPutSearchValue="20"
  305. end if
  306. end Function
  307.  Function URLDecode(enStr)
  308.   dim deStr
  309.   dim c,i,v
  310.   deStr=""
  311.   for i=1 to len(enStr)
  312.   c=Mid(enStr,i,1)
  313.   if c="%" then
  314.   v=eval("&h"+Mid(enStr,i+1,2))
  315.   if v<128 then
  316.   deStr=deStr&chr(v)
  317.   i=i+2
  318.   else
  319.   if isvalidhex(mid(enstr,i,3)) then
  320.   if isvalidhex(mid(enstr,i+3,3)) then
  321.   v=eval("&h"+Mid(enStr,i+1,2)+Mid(enStr,i+4,2))
  322.   deStr=deStr&chr(v)
  323.   i=i+5
  324.   else
  325.   v=eval("&h"+Mid(enStr,i+1,2)+cstr(hex(asc(Mid(enStr,i+3,1)))))
  326.   deStr=deStr&chr(v)
  327.   i=i+3 
  328.   end if 
  329.   else 
  330.   destr=destr&c
  331.   end if
  332.   end if
  333.   else
  334.   if c="+" then
  335.   deStr=deStr&" "
  336.   else
  337.   deStr=deStr&c
  338.   end if
  339.   end if
  340.   next
  341.   URLDecode=deStr
  342.   end function
  343.   function isvalidhex(str)
  344.   isvalidhex=true
  345.   str=ucase(str)
  346.   if len(str)<>3 then isvalidhex=false:exit function
  347.   if left(str,1)<>"%" then isvalidhex=false:exit function
  348.   c=mid(str,2,1)
  349.   if not (((c>="0") and (c<="9")) or ((c>="A") and (c<="Z"))) then isvalidhex=false:exit function
  350.   c=mid(str,3,1)
  351.   if not (((c>="0") and (c<="9")) or ((c>="A") and (c<="Z"))) then isvalidhex=false:exit function
  352.   end function
  353. function validate_string(input) 
  354. known_bad=array("select","insert","update","delete","drop","—","'",";","#") 
  355. validate_string=true 
  356. for i=lbound(known_bad) to ubound(known_bad) 
  357. if(instr(1,input,known_bad(i),vbtextcompare)<>0) then 
  358. validate_string=false 
  359. exit function 
  360. end if 
  361. next 
  362. end function 
  363. %>