Collecting.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:35k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../FS_Inc/Function.asp"-->
  4. <!--#include file="inc/Function.asp"-->
  5. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  6. <%
  7. Dim Conn,CollectConn
  8. MF_Default_Conn
  9. MF_Collect_Conn
  10. MF_Session_TF
  11. Response.Buffer = true
  12. Response.Expires = -1
  13. Response.ExpiresAbsolute = Now() - 1 
  14. Response.Expires = 0 
  15. Response.CacheControl = "no-cache"
  16. Dim p_SYS_ROOT_DIR,SiteID,ErrorInfoStr,Action,SaveIMGPath,ListHeadSetting,ListFootSetting,LinkHeadSetting,LinkFootSetting
  17. Dim PagebodyHeadSetting,PagebodyFootSetting,PageTitleHeadSetting,PageTitleFootSetting,OtherPageFootSetting,OtherPageHeadSetting
  18. Dim OtherNewsPageHeadSetting,OtherNewsPageFootSetting,AuthorHeadSetting,AuthorFootSetting,SourceHeadSetting,SourceFootSetting
  19. Dim AddDateHeadSetting,AddDateFootSetting,IndexRule,StartPageNum,EndPageNum,HandPageContent,OtherType
  20. Dim IsStyle,IsDiv,IsA,IsClass,IsFont,IsSpan,IsObjectTF,IsIFrame,IsScript,HandSetAuthor,HandSetSource,HandSetAddDate,TextTF,SaveRemotePic,IsReverse
  21. Dim ObjURL,ReturnValue,CollectStartLocation,CollectEndFlag,CollectObjURL,CollectedPageURL,p_DoMain_Str
  22. Dim SiteName,CollectingSiteID,CollectSiteIndex,AllNewsNumber,CollectOKNumber,CollectPageNumber,Num,CollectType
  23. Dim OtherNewsType,OtherNewsPageIndexSetting,OtherNewsPageIndexSettingStartPageNum,OtherNewsPageIndexSettingEndPageNum,OtherNewsPageIndexSettingHandPageContent
  24. if G_VIRTUAL_ROOT_DIR = "" then
  25. p_SYS_ROOT_DIR = ""
  26. else
  27. p_SYS_ROOT_DIR = "/" & G_VIRTUAL_ROOT_DIR
  28. end if
  29. p_DoMain_Str = "http://"&Request.Cookies("FoosunMFCookies")("FoosunMFDomain")
  30. Action = Request("Action")
  31. SiteID = Request("SiteID")
  32. ErrorInfoStr = ""
  33. CollectEndFlag = False
  34. CollectedPageURL = Request("CollectedPageURL")
  35. AllNewsNumber = Request("AllNewsNumber")
  36. if AllNewsNumber = "" then
  37. AllNewsNumber = 0
  38. else
  39. AllNewsNumber = CLng(AllNewsNumber)
  40. end if
  41. CollectOKNumber = Request("CollectOKNumber")
  42. if CollectOKNumber = "" then
  43. CollectOKNumber = 0
  44. else
  45. CollectOKNumber = CLng(CollectOKNumber)
  46. end if
  47. CollectSiteIndex = Request("CollectSiteIndex")
  48. if CollectSiteIndex = "" then
  49. CollectSiteIndex = 0
  50. else
  51. CollectSiteIndex = CInt(CollectSiteIndex)
  52. end if
  53. CollectPageNumber = Request("CollectPageNumber")
  54. if CollectPageNumber = "" then
  55. CollectPageNumber = 0
  56. else
  57. CollectPageNumber = CInt(CollectPageNumber)
  58. end if
  59. CollectStartLocation = Request("CollectStartLocation")
  60. if CollectStartLocation = "" then CollectStartLocation = 0
  61. Num = Request("Num")
  62. If Num = "allNews" Or Num="" Then 
  63. Num = 10
  64. Else
  65. if Not IsNumeric(Num) then
  66. Num = 10
  67. else
  68. Num = CInt(Num)
  69. end if
  70. End If
  71. CollectType = Request("CollectType")
  72. %>
  73. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  74. <html>
  75. <head>
  76. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  77. <title>[site] 管理后台 -- 风讯内容管理系统 FoosunCMS V4.0</title>
  78. <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  79. </head>
  80. <script language="JavaScript" src="js/PublicJS.js"></script>
  81. <body topmargin="2" leftmargin="2" oncontextmenu="//return false;">
  82. <table width="100%" border="0" cellpadding="1" cellspacing="1" class="table">
  83.   <tr bgcolor="xingmu"> 
  84.     <td height="26" colspan="5" valign="middle" class="hback">
  85.       <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
  86.         <tr>
  87.           <td style="cursor:hand;" width="35" id="StopCollect" align="center" alt="停止采集" onClick="location.href='Site.asp';" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="xingmu">取消</td>
  88.   <td width=2 class="Gray">|</td>
  89.           <td style="cursor:hand;" width="35" id="SaveCollect" align="center" alt="保存采集进度并返回" onClick="location.href='Site.asp';" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="xingmu">保存</td>
  90.   <td width=2 class="Gray">|</td>
  91.   <td style="cursor:hand;" width="35" align="center" alt="后退" onClick="history.back();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="xingmu">后退</td>
  92.           <td>&nbsp;</td>
  93.         </tr>
  94.       </table>
  95.     </td>
  96.   </tr>
  97. </table>
  98. <table width="100%" border="0" cellpadding="5" cellspacing="1" class="tabble">
  99.   <tr class="hback_1">
  100.     <td height="20"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  101.         <tr>
  102. <%If CollectType="ResumeCollect" then%>
  103. <td width="50%;" align="right"><font color="#FF0000" id="CollectEndArea">正在续采</font></td>
  104. <%else%>
  105. <td width="50%;" align="right"><font color="#FF0000" id="CollectEndArea">正在采集</font></td>
  106. <%End if%>
  107. <td width="50%;">&nbsp;<font color="#FF0000" id="ShowInfoArea" size="+1">&nbsp;</font></td>
  108.         </tr>
  109.       </table></td>
  110.   </tr>
  111.   <tr> 
  112.     <td valign="middle" class="hback">
  113. <%
  114. if Action = "Submit" then
  115. if SiteID <> "" then
  116. GetCollectPara
  117. If AllNewsNumber>=Num And Num<>0 Then 
  118. CollectEndFlag = True
  119. End If
  120. if CollectEndFlag then
  121. if ErrorInfoStr <> "" then
  122. Response.Write(ErrorInfoStr)
  123. else
  124. ReturnValue = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>采集结束</strong>: 共读取" & AllNewsNumber & "条新闻,采集成功" & CollectOKNumber & "条新闻。"
  125. Response.Write(ReturnValue)
  126. Response.Write("<script language=""JavaScript"">setTimeout('SetCollectEndStr();',100);</script>")
  127. end if
  128. elseif CollectType<>"ResumeCollect" Then
  129. GetNewsPageContent()
  130. if CollectStartLocation = 0 then
  131. ReturnValue = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong><font color=red>采集分页" & CollectPageNumber & "</font></strong>:" & "<a target=""_blank"" href=""" & ObjURL & """>" & ObjURL & "</a><br>" & ReturnValue
  132. else
  133. ReturnValue = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong><font color=red>采集分页" & CollectPageNumber + 1 & "</font></strong>:" & "<a target=""_blank"" href=""" & ObjURL & """>" & ObjURL & "</a><br>" & ReturnValue
  134. end if
  135. ReturnValue = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong><font color=red>采集站点</font></strong>:" & SiteName & "<br>" & ReturnValue
  136. ReturnValue = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong><font color=red>采集结果</font></strong>:已经读取" & AllNewsNumber & "条新闻,保存" & CollectOKNumber & "条新闻<br>" & ReturnValue
  137. Response.Write(ReturnValue & "<meta http-equiv=""refresh"" content=""2;url=Collecting.asp?Action=Submit&CollectPageNumber=" & CollectPageNumber & "&SiteID=" & SiteID & "&CollectStartLocation=" & CollectStartLocation & "&CollectedPageURL=" & CollectedPageURL & "&CollectSiteIndex=" & CollectSiteIndex & "&Num=" & Num & "&AllNewsNumber=" & AllNewsNumber & "&CollectOKNumber=" & CollectOKNumber & """>")
  138. else
  139. ResumeGetNewsPageContent()
  140. if CollectStartLocation = 0 then
  141. ReturnValue = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong><font color=red>采集分页" & CollectPageNumber & "</font></strong>:" & "<a target=""_blank"" href=""" & ObjURL & """>" & ObjURL & "</a><br>" & ReturnValue
  142. else
  143. ReturnValue = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong><font color=red>采集分页" & CollectPageNumber + 1 & "</font></strong>:" & "<a target=""_blank"" href=""" & ObjURL & """>" & ObjURL & "</a><br>" & ReturnValue
  144. end if
  145. ReturnValue = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong><font color=red>采集站点</font></strong>:" & SiteName & "<br>" & ReturnValue
  146. ReturnValue = "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong><font color=red>采集结果</font></strong>:已经读取" & AllNewsNumber & "条新闻,续采了" & CollectOKNumber & "条新闻<br>" & ReturnValue
  147. Response.Write(ReturnValue & "<meta http-equiv=""refresh"" content=""2;url=Collecting.asp?Action=Submit&CollectType=ResumeCollect&CollectPageNumber=" & CollectPageNumber & "&SiteID=" & SiteID & "&CollectStartLocation=" & CollectStartLocation & "&CollectedPageURL=" & CollectedPageURL & "&CollectSiteIndex=" & CollectSiteIndex & "&AllNewsNumber=" & AllNewsNumber & "&CollectOKNumber=" & CollectOKNumber & """>")
  148. end if
  149. end if
  150. end if
  151. %>
  152. </td>
  153.   </tr>
  154. </table>
  155. </body>
  156. </html>
  157. <script language="JavaScript">
  158. var ForwardShow=true;
  159. function ShowPromptInfo()
  160. {
  161. var TempStr=document.all.ShowInfoArea.innerText;
  162. if (ForwardShow==true)
  163. {
  164. if (TempStr.length>4) ForwardShow=false;
  165. document.all.ShowInfoArea.innerText=TempStr+'.';
  166. }
  167. else
  168. {
  169. if (TempStr.length==2) ForwardShow=true;
  170. document.all.ShowInfoArea.innerText=TempStr.substr(0,TempStr.length-1);
  171. }
  172. }
  173. function SetCollectEndStr()
  174. {
  175. document.all.CollectEndArea.innerText='采集结束,3秒钟后返回主页面';
  176. setTimeout("location='Site.asp';",3000);
  177. }
  178. window.setInterval('ShowPromptInfo()',500);</script>
  179. <% if Action = "" then %>
  180. <script language="JavaScript">
  181. setTimeout("location='?SiteID=<% = SiteID %>&CollectType=<%= CollectType %>&Action=Submit&Num=<%= Num %>';",10);
  182. </script>
  183. <% end if %>
  184. <%
  185. Set Conn = Nothing
  186. Set CollectConn = Nothing
  187. Function GetCollectPara()
  188. Dim RsSiteObj,Sql,SiteIDArray
  189. if SiteID = "" then
  190. ErrorInfoStr = "没有采集站点,请重试"
  191. Exit Function
  192. end if
  193. SiteIDArray = Split(SiteID,"***")
  194. if CollectSiteIndex > UBound(SiteIDArray) then
  195. CollectEndFlag = True
  196. Exit Function
  197. end if
  198. CollectingSiteID = SiteIDArray(CollectSiteIndex)
  199. Sql = "Select * from FS_Site where ID=" & CollectingSiteID
  200. Set RsSiteObj = CollectConn.Execute(Sql)
  201. if RsSiteObj.Eof then
  202. Set RsSiteObj = Nothing
  203. ErrorInfoStr = "没有采集站点,请重试"
  204. Exit Function
  205. else
  206. SiteName = RsSiteObj("SiteName")
  207. ListHeadSetting = RsSiteObj("ListHeadSetting")
  208. ListFootSetting = RsSiteObj("ListFootSetting")
  209. LinkHeadSetting = RsSiteObj("LinkHeadSetting")
  210. LinkFootSetting = RsSiteObj("LinkFootSetting")
  211. PagebodyHeadSetting = RsSiteObj("PagebodyHeadSetting")
  212. PagebodyFootSetting = RsSiteObj("PagebodyFootSetting")
  213. PageTitleHeadSetting = RsSiteObj("PageTitleHeadSetting")
  214. PageTitleFootSetting = RsSiteObj("PageTitleFootSetting")
  215. OtherPageFootSetting = RsSiteObj("OtherPageFootSetting")
  216. OtherPageHeadSetting = RsSiteObj("OtherPageHeadSetting")
  217. OtherNewsType = RsSiteObj("OtherNewsType")
  218. OtherNewsPageHeadSetting = RsSiteObj("OtherNewsPageHeadSetting")
  219. OtherNewsPageFootSetting = RsSiteObj("OtherNewsPageFootSetting")
  220. OtherNewsPageIndexSetting = RsSiteObj("OtherNewsPageIndexSetting")
  221. OtherNewsPageIndexSettingStartPageNum = RsSiteObj("OtherNewsPageIndexSettingStartPageNum")
  222. OtherNewsPageIndexSettingEndPageNum = RsSiteObj("OtherNewsPageIndexSettingEndPageNum")
  223. OtherNewsPageIndexSettingHandPageContent = RsSiteObj("OtherNewsPageIndexSettingHandPageContent")
  224. AuthorHeadSetting = RsSiteObj("AuthorHeadSetting")
  225. AuthorFootSetting = RsSiteObj("AuthorFootSetting")
  226. SourceHeadSetting = RsSiteObj("SourceHeadSetting")
  227. SourceFootSetting = RsSiteObj("SourceFootSetting")
  228. AddDateHeadSetting = RsSiteObj("AddDateHeadSetting")
  229. AddDateFootSetting = RsSiteObj("AddDateFootSetting")
  230. TextTF = RsSiteObj("TextTF")
  231. SaveRemotePic = RsSiteObj("SaveRemotePic")
  232. CollectObjURL = RsSiteObj("objURL")
  233. Dim p_Root_Path
  234. p_Root_Path = p_SYS_ROOT_DIR & "/" & G_UP_FILES_DIR & "/" & G_SAVE_FILE_PATH
  235. CreatePath Server.MapPath(p_Root_Path & "/" & Year(Date) & "-" & Month(Date) & "/" & Day(Date)),Server.MapPath(p_SYS_ROOT_DIR & "/" & G_UP_FILES_DIR)
  236. SaveIMGPath = p_Root_Path & "/" & Year(Date) & "-" & Month(Date) & "/" & Day(Date)
  237. IsStyle = RsSiteObj("IsStyle")
  238. IsDiv = RsSiteObj("IsDiv")
  239. IsA = RsSiteObj("IsA")
  240. IsClass = RsSiteObj("IsClass")
  241. IsFont = RsSiteObj("IsFont")
  242. IsSpan = RsSiteObj("IsSpan")
  243. IsObjectTF = RsSiteObj("IsObject")
  244. IsIFrame = RsSiteObj("IsIFrame")
  245. IsScript = RsSiteObj("IsScript")
  246. IndexRule = RsSiteObj("IndexRule")
  247. StartPageNum = RsSiteObj("StartPageNum")
  248. EndPageNum = RsSiteObj("EndPageNum")
  249. HandPageContent = RsSiteObj("HandPageContent")
  250. OtherType = RsSiteObj("OtherType")
  251. HandSetAuthor = RsSiteObj("HandSetAuthor")
  252. HandSetSource = RsSiteObj("HandSetSource")
  253. HandSetAddDate = RsSiteObj("HandSetAddDate")
  254. ObjURL = GetOtherURL(CollectPageNumber,RsSiteObj)
  255. IsReverse=RsSiteObj("IsReverse")
  256. if ObjURL = "" then
  257. CollectPageNumber = 0
  258. CollectStartLocation = 0
  259. CollectedPageURL = ""
  260. CollectSiteIndex = CollectSiteIndex + 1
  261. Set RsSiteObj = Nothing
  262. GetCollectPara
  263. Exit Function
  264. else
  265. if CollectPageNumber > G_NEWS_LIST_PAGES_NUMBER then
  266. CollectPageNumber = 0
  267. CollectStartLocation = 0
  268. CollectedPageURL = ""
  269. CollectSiteIndex = CollectSiteIndex + 1
  270. Set RsSiteObj = Nothing
  271. GetCollectPara
  272. Exit Function
  273. end if
  274. end if
  275. end if
  276. Set RsSiteObj = Nothing
  277. End Function
  278. Function GetOtherURL(PageNum,Obj) '取得其他新闻列表的URL
  279. Dim OtherObjURL,OtherResponseAllStr,OtherNewsListArray,i
  280. if PageNum = 0 then
  281. GetOtherURL = CollectObjURL
  282. CollectedPageURL = ""
  283. else
  284. Select Case OtherType
  285. Case 0 '不分页
  286. GetOtherURL = ""
  287. Case 1 '标记分页
  288. if IsNull(OtherPageHeadSetting) OR IsNull(OtherPageFootSetting) OR (OtherPageFootSetting = "") OR (OtherPageHeadSetting = "") then
  289. GetOtherURL = ""
  290. else
  291. if PageNum = 1 then
  292. CollectedPageURL = CollectObjURL
  293. end if
  294. OtherResponseAllStr = GetPageContent(FormatUrl(CollectedPageURL,CollectObjURL))
  295. OtherObjURL = GetOtherContent(OtherResponseAllStr,OtherPageHeadSetting,OtherPageFootSetting)
  296. if OtherObjURL <> "" then
  297. OtherObjURL = FormatUrl(OtherObjURL,CollectObjURL)
  298. else
  299. OtherObjURL = ""
  300. end if
  301. GetOtherURL = OtherObjURL
  302. end if
  303. Case 2 '索引分页
  304. if IsNull(IndexRule) OR (IndexRule = "") OR IsNull(StartPageNum) OR (StartPageNum = "") OR IsNull(EndPageNum) OR (EndPageNum = "") then
  305. GetOtherURL = ""
  306. else
  307. if Not IsNumeric(StartPageNum) OR Not IsNumeric(EndPageNum) then
  308. GetOtherURL = ""
  309. else
  310. if CInt(StartPageNum) < CInt(EndPageNum) Then '按从小到大的页数
  311. if PageNum >= CInt(EndPageNum) then
  312. GetOtherURL = ""
  313. else
  314. if PageNum = 1 then
  315. IndexRule = Replace(FormatUrl(IndexRule,CollectObjURL),"^$^",StartPageNum)
  316. else
  317. StartPageNum = CInt(StartPageNum) + PageNum - 1
  318. IndexRule = Replace(FormatUrl(IndexRule,CollectObjURL),"^$^",StartPageNum)
  319. end if
  320. GetOtherURL = IndexRule
  321. end if
  322. Else  '按从大到小的页数,从而实现倒序采集,比如从10到1
  323. if PageNum >= CInt(StartPageNum) then
  324. GetOtherURL = ""
  325. else
  326. if PageNum = 1 then
  327. IndexRule = Replace(FormatUrl(IndexRule,CollectObjURL),"^$^",StartPageNum)
  328. else
  329. EndPageNum = CInt(StartPageNum) - PageNum + 1
  330. IndexRule = Replace(FormatUrl(IndexRule,CollectObjURL),"^$^",EndPageNum)
  331. end if
  332. GetOtherURL = IndexRule
  333. end if
  334. end if
  335. end if
  336. end if
  337. Case 3 '手工分页
  338. if IsNull(HandPageContent) OR (HandPageContent = "") then
  339. GetOtherURL = ""
  340. ElseIf InStr(HandPageContent,Chr(10))=0 And PageNum<2 Then
  341. GetOtherURL = HandPageContent
  342. Else
  343. HandPageContent = Split(HandPageContent,Chr(10))
  344. if PageNum > UBound(HandPageContent) then
  345. GetOtherURL = ""
  346. else
  347. if HandPageContent(PageNum - 1) <> "" then
  348. GetOtherURL = HandPageContent(PageNum - 1)
  349. else
  350. GetOtherURL = ""
  351. end if
  352. end if
  353. end if
  354. Case Else
  355. GetOtherURL = ""
  356. End Select
  357. end if
  358. End Function
  359. Function GetNewsPageContent()
  360. Dim NewsPageStr,TitleStr,ContentStr,AuthorStr,SourceStr,AddDate,i
  361. Dim ResponseAllStr,NewsListStr,NewsLinkStr,RsCheckNewsObj
  362. Dim NewsListStrArray,TempArray
  363. ResponseAllStr = GetPageContent(FormatUrl(ObjURL,CollectObjURL))
  364. if ResponseAllStr = False then
  365. CollectPageNumber = CollectPageNumber + 1
  366. ReturnValue = ReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>错误</strong>:读取新闻列表页面失败<br>"
  367. Exit Function
  368. end if
  369. Dim BLinkHeadSetting,BLinkFootSetting
  370. BLinkHeadSetting = False
  371. BLinkFootSetting = False
  372. If Instr(LinkHeadSetting,"[变量]")<=0 Then
  373. BLinkHeadSetting = True
  374. ElseIf Instr(LinkFootSetting,"[变量]")<=0 Then
  375. BLinkFootSetting = True
  376. End If
  377. If InStr(ResponseAllStr,ListHeadSetting)>0 And InStr(ResponseAllStr,ListFootSetting) <> 0 Then
  378. NewsListStr = GetOtherContent(ResponseAllStr,ListHeadSetting,ListFootSetting)
  379. Else 
  380. NewsListStr = ResponseAllStr
  381. End If
  382. If BLinkHeadSetting Then
  383. NewsListStr = Mid(NewsListStr,Instr(NewsListStr,LinkHeadSetting)+len(LinkHeadSetting))
  384. NewsListStrArray = Split(NewsListStr,LinkHeadSetting)
  385. elseif BLinkFootSetting Then 
  386. NewsListStr = Left(NewsListStr,InstrRev(NewsListStr,LinkFootSetting))
  387. NewsListStrArray = Split(NewsListStr,LinkFootSetting)
  388. else
  389. NewsListStrArray = Array("")
  390. End If
  391. '倒序采集
  392. If IsReverse="1" then 
  393. Dim TempArr,j
  394. TempArr=NewsListStrArray
  395. For j =0 to UBound(NewsListStrArray)
  396. NewsListStrArray(j)=TempArr(UBound(NewsListStrArray)-j)
  397. Next 
  398. If Num>0 And Num-1<=UBound(NewsListStrArray) Then
  399. TempArr=NewsListStrArray
  400. For j =0 to Num-1 'UBound(NewsListStrArray)
  401. NewsListStrArray(j)=TempArr(UBound(NewsListStrArray)-Num+j+1)
  402. Next 
  403. End If 
  404. End If
  405. For i = CollectStartLocation to CollectStartLocation + CollectMaxOfOnePage - 1
  406. if i > UBound(NewsListStrArray) Or (i >= Num And Num<>0) then
  407. CollectPageNumber = CollectPageNumber + 1
  408. CollectStartLocation = 0
  409. CollectedPageURL = ObjURL
  410. Exit Function
  411. end If
  412. AllNewsNumber = AllNewsNumber + 1
  413. if NewsListStrArray(i) <> "" then
  414. If BLinkHeadSetting=True Then
  415. TempArray = GetOtherContent(LinkHeadSetting&NewsListStrArray(i),LinkHeadSetting,LinkFootSetting) 
  416. ElseIf BLinkFootSetting=True Then 
  417. TempArray = GetOtherContent(NewsListStrArray(i)&LinkFootSetting,LinkHeadSetting,LinkFootSetting) 
  418. End If 
  419. if TempArray <> "" Then
  420. NewsLinkStr = LoseHtml(FormatUrl(TempArray,CollectObjURL))
  421. NewsPageStr = GetPageContent(NewsLinkStr)
  422. if NewsPageStr <> False then
  423. TitleStr = LoseHtml(GetOtherContent(NewsPageStr,PageTitleHeadSetting,PageTitleFootSetting))
  424. Set RsCheckNewsObj = CollectConn.Execute("Select * from FS_News where Links='" & NewsLinkStr & "'")
  425. if Not RsCheckNewsObj.Eof then
  426. ReturnValue = GetOneNewsReturnValue(1,i + 1,TitleStr,"",NewsLinkStr) & ReturnValue
  427. else
  428. ContentStr = ReplaceKeyWords(GetOneNewsContent(NewsPageStr,NewsLinkStr))
  429. ContentStr = ReplaceContentStr(ContentStr)
  430. if SaveRemotePic then ContentStr = ReplaceIMGRemoteUrl(ContentStr,SaveIMGPath,p_DoMain_Str,p_SYS_ROOT_DIR,NewsLinkStr,SaveRemotePic)
  431. if TitleStr = "" then
  432. ReturnValue = GetOneNewsReturnValue(2,i + 1,"","",NewsLinkStr) & ReturnValue
  433. elseif ContentStr = "" then
  434. ReturnValue = GetOneNewsReturnValue(3,i + 1,TitleStr,"",NewsLinkStr) & ReturnValue
  435. else
  436. ReturnValue = GetOneNewsReturnValue(4,i + 1,TitleStr,ContentStr,NewsLinkStr) & ReturnValue
  437. if IsNull(HandSetAuthor) OR (HandSetAuthor = "") then
  438. AuthorStr = LoseHtml(GetOtherContent(NewsPageStr,AuthorHeadSetting,AuthorFootSetting))
  439. else
  440. AuthorStr = HandSetAuthor
  441. end if
  442. if IsNull(HandSetSource) OR (HandSetSource = "") then
  443. SourceStr = LoseHtml(GetOtherContent(NewsPageStr,SourceHeadSetting,SourceFootSetting))
  444. else
  445. SourceStr = HandSetSource
  446. end if
  447. if IsNull(HandSetAddDate) OR Not IsDate(HandSetSource) then
  448. AddDate = LoseHtml(GetOtherContent(NewsPageStr,AddDateHeadSetting,AddDateFootSetting))
  449. else
  450. AddDate = HandSetSource
  451. end if
  452. if AddDate <> "" then
  453. if Not IsDate(AddDate) then AddDate = Now
  454. else
  455. AddDate = Now
  456. end if
  457. SaveCollectContent TitleStr,NewsLinkStr,ContentStr,AuthorStr,SourceStr,AddDate
  458. end if
  459. end if
  460. Set RsCheckNewsObj = Nothing
  461. else
  462. ReturnValue = GetOneNewsReturnValue(5,i + 1,"","",NewsLinkStr) & ReturnValue
  463. end if
  464. else
  465. ReturnValue = GetOneNewsReturnValue(5,i + 1,"","",NewsLinkStr) & ReturnValue
  466. end if
  467. else
  468. ReturnValue = GetOneNewsReturnValue(5,i + 1,"","",NewsLinkStr) & ReturnValue
  469. end if
  470. Next
  471. CollectStartLocation = i
  472. End Function
  473. Function ResumeGetNewsPageContent()
  474. dim ResumeSql,RsResumeNewsObj,ResumeNewsURL,ResumeNewsURL1,ResumeNewsLocation
  475. ResumeSql = "Select top 1 Links from FS_News where SiteID='" & CollectingSiteID &"' order by ID DESC"
  476. Set RsResumeNewsObj = CollectConn.Execute(ResumeSql)
  477. If RsResumeNewsObj.EOF Then 
  478. set RsResumeNewsObj = nothing
  479. response.Write("<script>alert(""无法确定您以前的采集记录,n续采失败!"");history.go(-2);</script>")
  480. else
  481. ResumeNewsURL = RsResumeNewsObj("Links")
  482. set RsResumeNewsObj = nothing
  483. End If
  484. Dim NewsPageStr,TitleStr,ContentStr,AuthorStr,SourceStr,AddDate,i,n
  485. Dim ResponseAllStr,NewsListStr,NewsLinkStr,RsCheckNewsObj
  486. Dim NewsListStrArray,TempArray
  487. ResponseAllStr = GetPageContent(FormatUrl(ObjURL,CollectObjURL))
  488. if ResponseAllStr = False then
  489. CollectPageNumber = CollectPageNumber + 1
  490. ReturnValue = ReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>错误</strong>:读取新闻列表页面失败<br>"
  491. Exit Function
  492. end if
  493. Dim BLinkHeadSetting,BLinkFootSetting
  494. BLinkHeadSetting = False
  495. BLinkFootSetting = False
  496. If Instr(LinkHeadSetting,"[变量]")<=0 Then
  497. BLinkHeadSetting = True
  498. elseif Instr(LinkFootSetting,"[变量]")<=0 Then
  499. BLinkFootSetting = True
  500. End If
  501. If InStr(ResponseAllStr,ListHeadSetting)>0 And InStr(ResponseAllStr,ListFootSetting) Then
  502. NewsListStr = GetOtherContent(ResponseAllStr,ListHeadSetting,ListFootSetting)
  503. Else 
  504. NewsListStr = ResponseAllStr
  505. End If
  506. If BLinkHeadSetting Then
  507. NewsListStr = Mid(NewsListStr,Instr(NewsListStr,LinkHeadSetting)+len(LinkHeadSetting))
  508. NewsListStrArray = Split(NewsListStr,LinkHeadSetting)
  509. elseif BLinkFootSetting Then 
  510. NewsListStr = Left(NewsListStr,InstrRev(NewsListStr,LinkFootSetting))
  511. NewsListStrArray = Split(NewsListStr,LinkFootSetting)
  512. End If
  513. For n = 0 to UBound(NewsListStrArray)
  514. Dim tempURL
  515. tempURL=LoseHtml(FormatUrl(GetOtherContent(LinkHeadSetting&NewsListStrArray(n),LinkHeadSetting,LinkFootSetting),CollectObjURL))
  516. If ResumeNewsURL = tempURL Then
  517. Exit For
  518. ElseIf n>=UBound(NewsListStrArray) Then
  519. AllNewsNumber = AllNewsNumber+n
  520. CollectPageNumber = CollectPageNumber + 1
  521. CollectStartLocation = 0
  522. CollectedPageURL = ObjURL
  523. Exit Function 
  524. End If
  525. Next 
  526. CollectStartLocation = n+1
  527. If IsReverse="1" then '倒序采集
  528. Dim TempArr,j
  529. TempArr=NewsListStrArray
  530. For j =0 to UBound(NewsListStrArray)
  531. NewsListStrArray(j)=TempArr(UBound(NewsListStrArray)-j)
  532. Next 
  533. End If
  534. For i = CollectStartLocation to CollectStartLocation + CollectMaxOfOnePage - 1
  535. if i > UBound(NewsListStrArray) Then
  536. CollectPageNumber = CollectPageNumber + 1
  537. CollectStartLocation = 0
  538. CollectedPageURL = ObjURL
  539. Exit Function
  540. end If
  541. AllNewsNumber = AllNewsNumber + 1
  542. If BLinkHeadSetting Then
  543. TempArray = GetOtherContent(LinkHeadSetting&NewsListStrArray(i),LinkHeadSetting,LinkFootSetting) 
  544. elseif BLinkFootSetting Then 
  545. TempArray = GetOtherContent(NewsListStrArray(i)&LinkFootSetting,LinkHeadSetting,LinkFootSetting) 
  546. End If  
  547. if TempArray <> "" Then
  548. NewsLinkStr = LoseHtml(FormatUrl(TempArray,CollectObjURL))
  549. Set RsCheckNewsObj = CollectConn.Execute("Select * from FS_News where Links='" & NewsLinkStr & "'")
  550. if RsCheckNewsObj.Eof then
  551. NewsPageStr = GetPageContent(NewsLinkStr)
  552. if NewsPageStr <> False then
  553. TitleStr = LoseHtml(GetOtherContent(NewsPageStr,PageTitleHeadSetting,PageTitleFootSetting))
  554. Set RsCheckNewsObj = CollectConn.Execute("Select * from FS_News where Links='" & NewsLinkStr & "'")
  555. ContentStr = ReplaceKeyWords(GetOneNewsContent(NewsPageStr,NewsLinkStr))
  556. ContentStr = ReplaceContentStr(ContentStr)
  557. if SaveRemotePic then ContentStr = ReplaceIMGRemoteUrl(ContentStr,SaveIMGPath,p_DoMain_Str,p_SYS_ROOT_DIR,NewsLinkStr,SaveRemotePic)
  558. if TitleStr = "" then
  559. ReturnValue = GetOneNewsReturnValue(2,i + 1,"","",NewsLinkStr) & ReturnValue
  560. elseif ContentStr = "" then
  561. ReturnValue = GetOneNewsReturnValue(3,i + 1,TitleStr,"",NewsLinkStr) & ReturnValue
  562. else
  563. ReturnValue = GetOneNewsReturnValue(4,i + 1,TitleStr,ContentStr,NewsLinkStr) & ReturnValue
  564. if IsNull(HandSetAuthor) OR (HandSetAuthor = "") then
  565. AuthorStr = LoseHtml(GetOtherContent(NewsPageStr,AuthorHeadSetting,AuthorFootSetting))
  566. else
  567. AuthorStr = HandSetAuthor
  568. end if
  569. if IsNull(HandSetSource) OR (HandSetSource = "") then
  570. SourceStr = LoseHtml(GetOtherContent(NewsPageStr,SourceHeadSetting,SourceFootSetting))
  571. else
  572. SourceStr = HandSetSource
  573. end if
  574. if IsNull(HandSetAddDate) OR Not IsDate(HandSetSource) then
  575. AddDate = LoseHtml(GetOtherContent(NewsPageStr,AddDateHeadSetting,AddDateFootSetting))
  576. else
  577. AddDate = HandSetSource
  578. end if
  579. if AddDate <> "" then
  580. if Not IsDate(AddDate) then AddDate = Now
  581. else
  582. AddDate = Now
  583. end if
  584. SaveCollectContent TitleStr,NewsLinkStr,ContentStr,AuthorStr,SourceStr,AddDate
  585. end if
  586. Set RsCheckNewsObj = Nothing
  587. else
  588. ReturnValue = GetOneNewsReturnValue(5,i + 1,"","",NewsLinkStr) & ReturnValue
  589. End If
  590. ElseIf session("ConfirmCollectRevert")<>"ConfirmCollectRevert" Then
  591. session("ConfirmCollectRevert") = "ConfirmCollectRevert"
  592. response.write("<script>if(confirm(""您改变过采集顺序吗?n如果修改过,请单击确定改回原样再续采!n没有修改过请单击取消继续!""))window.location=""site.asp""</script>")
  593. End If
  594. End If
  595. Next
  596. CollectStartLocation = i
  597. End Function
  598. Function GetOneNewsContent(FirstPageContent,NewsLinkStr)
  599. Dim OtherPageNewsLink,OtherPageNewsContentStr,tempSplitArr1,tempSplitArr2
  600. Dim f_Collect_Index,f_Temp_Array,f_URL,f_Start,f_End,f_Int,f_I
  601. 'On Error Resume Next
  602. f_Collect_Index = 0
  603. OtherPageNewsContentStr = FirstPageContent
  604. GetOneNewsContent = GetOtherContent(FirstPageContent,PagebodyHeadSetting,PagebodyFootSetting)
  605. Select Case OtherNewsType
  606. Case 0
  607. Case 1
  608. if IsNull(OtherNewsPageHeadSetting) OR IsNull(OtherNewsPageFootSetting) OR (OtherNewsPageHeadSetting = "") OR (OtherNewsPageFootSetting = "") Then
  609. OtherPageNewsLink = ""
  610. ElseIf InStr(OtherPageNewsContentStr,OtherNewsPageFootSetting)>0 And InStr(OtherPageNewsContentStr,OtherNewsPageHeadSetting)>0 Then
  611. tempSplitArr1 = Split(OtherPageNewsContentStr,OtherNewsPageHeadSetting)
  612. tempSplitArr2 = Split(tempSplitArr1(1),OtherNewsPageFootSetting)
  613. OtherPageNewsLink = tempSplitArr2(0)
  614. Else
  615. OtherPageNewsLink =  GetOtherContent(OtherPageNewsContentStr,OtherNewsPageHeadSetting,OtherNewsPageFootSetting)
  616. End If
  617. Do While (OtherPageNewsLink <> "")
  618. OtherPageNewsLink = FormatUrl(OtherPageNewsLink,NewsLinkStr)
  619. OtherPageNewsContentStr = GetPageContent(OtherPageNewsLink)
  620. If  InStr(OtherPageNewsContentStr,OtherNewsPageFootSetting)>0 And InStr(OtherPageNewsContentStr,OtherNewsPageHeadSetting)>0 Then
  621. tempSplitArr1 = Split(OtherPageNewsContentStr,OtherNewsPageHeadSetting)
  622. tempSplitArr2 = Split(tempSplitArr1(1),OtherNewsPageFootSetting)
  623. OtherPageNewsLink = tempSplitArr2(0)
  624. Else
  625. OtherPageNewsLink =  GetOtherContent(OtherPageNewsContentStr,OtherNewsPageHeadSetting,OtherNewsPageFootSetting)
  626. End If
  627. If OtherPageNewsContentStr<>False Then
  628. GetOneNewsContent = GetOneNewsContent & "[Page]" & GetOtherContent(OtherPageNewsContentStr,PagebodyHeadSetting,PagebodyFootSetting)
  629. Else
  630. OtherPageNewsLink = ""
  631. End If
  632. If Err Then
  633. Err.clear
  634. OtherPageNewsLink = ""
  635. End If
  636. Loop
  637. Case 2
  638. if IsNull(OtherNewsPageIndexSetting) OR (OtherNewsPageIndexSetting = "") OR IsNull(OtherNewsPageIndexSettingStartPageNum) OR (OtherNewsPageIndexSettingStartPageNum = "") OR IsNull(OtherNewsPageIndexSettingEndPageNum) OR (OtherNewsPageIndexSettingEndPageNum = "") then
  639. else
  640. if Not IsNumeric(OtherNewsPageIndexSettingStartPageNum) OR Not IsNumeric(OtherNewsPageIndexSettingEndPageNum) then
  641. else
  642. f_Start = CInt(OtherNewsPageIndexSettingStartPageNum)
  643. f_End = CInt(OtherNewsPageIndexSettingEndPageNum)
  644. if f_Start > f_End Then
  645. f_Int = f_Start
  646. f_Start = f_End
  647. f_End = f_Int
  648. end if
  649. do while f_Start + f_Collect_Index <= f_End
  650. f_URL = Replace(FormatUrl(OtherNewsPageIndexSetting,CollectObjURL),"^$^",f_Start + f_Collect_Index)
  651. OtherPageNewsLink = FormatUrl(f_URL,NewsLinkStr)
  652. OtherPageNewsContentStr = GetPageContent(OtherPageNewsLink)
  653. If InStr(OtherPageNewsContentStr,OtherNewsPageFootSetting)>0 And InStr(OtherPageNewsContentStr,OtherNewsPageHeadSetting)>0 Then
  654. tempSplitArr1 = Split(OtherPageNewsContentStr,OtherNewsPageHeadSetting)
  655. tempSplitArr2 = Split(tempSplitArr1(1),OtherNewsPageFootSetting)
  656. OtherPageNewsLink = tempSplitArr2(0)
  657. Else
  658. OtherPageNewsLink = GetOtherContent(OtherPageNewsContentStr,OtherNewsPageHeadSetting,OtherNewsPageFootSetting)
  659. End If
  660. If OtherPageNewsContentStr <> False Then GetOneNewsContent = GetOneNewsContent & "[Page]" & GetOtherContent(OtherPageNewsContentStr,PagebodyHeadSetting,PagebodyFootSetting)
  661. If Err Then Err.clear
  662. f_Collect_Index = f_Collect_Index + 1
  663. Loop
  664. end if
  665. end if
  666. Case 3 '手工分页
  667. if IsNull(OtherNewsPageIndexSettingHandPageContent) OR (OtherNewsPageIndexSettingHandPageContent = "") then
  668. Else
  669. f_Temp_Array = Split(OtherNewsPageIndexSettingHandPageContent,Chr(10))
  670. for f_I = LBound(f_Temp_Array) to UBound(f_Temp_Array)
  671. if f_Temp_Array(f_I) <> "" then
  672. OtherPageNewsLink = FormatUrl(f_Temp_Array(f_I),NewsLinkStr)
  673. OtherPageNewsContentStr = GetPageContent(OtherPageNewsLink)
  674. If InStr(OtherPageNewsContentStr,OtherNewsPageFootSetting)>0 And InStr(OtherPageNewsContentStr,OtherNewsPageHeadSetting)>0 Then
  675. tempSplitArr1 = Split(OtherPageNewsContentStr,OtherNewsPageHeadSetting)
  676. tempSplitArr2 = Split(tempSplitArr1(1),OtherNewsPageFootSetting)
  677. OtherPageNewsLink = tempSplitArr2(0)
  678. Else
  679. OtherPageNewsLink = GetOtherContent(OtherPageNewsContentStr,OtherNewsPageHeadSetting,OtherNewsPageFootSetting)
  680. End If
  681. If OtherPageNewsContentStr <> False Then GetOneNewsContent = GetOneNewsContent & "[Page]" & GetOtherContent(OtherPageNewsContentStr,PagebodyHeadSetting,PagebodyFootSetting)
  682. If Err Then Err.clear
  683. end if
  684. Next
  685. end if
  686. Case Else
  687. End Select
  688. End Function 
  689. Function GetOneNewsReturnValue(CauseIndex,NewsIndex,Title,Content,LinkStr)
  690. Select Case CauseIndex
  691. Case 1  '不允许重名保存
  692. GetOneNewsReturnValue = "</br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>序号</strong>: " & NewsIndex
  693. GetOneNewsReturnValue = GetOneNewsReturnValue & "&nbsp;&nbsp;&nbsp;&nbsp;<strong>结果</strong>: <font color=red>已经采集,在等待审核或者在历史纪录里面</font>"
  694. GetOneNewsReturnValue = GetOneNewsReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>标题</strong>: " & Title
  695. GetOneNewsReturnValue = GetOneNewsReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>新闻链接</strong>: <a target=""_blank"" href=""" & LinkStr & """>" & LinkStr & "</a><br>"
  696. Case 2 '标题为空,没有保存
  697. GetOneNewsReturnValue = "</br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>序号</strong>: " & NewsIndex
  698. GetOneNewsReturnValue = GetOneNewsReturnValue & "&nbsp;&nbsp;&nbsp;&nbsp;<strong>结果</strong>: <font color=red>标题为空,没有保存</font>"
  699. GetOneNewsReturnValue = GetOneNewsReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>新闻链接</strong>: <a target=""_blank"" href=""" & LinkStr & """>" & LinkStr & "</a><br>"
  700. Case 3 '内容为空,没有保存
  701. GetOneNewsReturnValue = "</br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>序号</strong>: " & NewsIndex
  702. GetOneNewsReturnValue = GetOneNewsReturnValue & "&nbsp;&nbsp;&nbsp;&nbsp;<strong>结果</strong>: <font color=red>内容为空,没有保存</font>"
  703. GetOneNewsReturnValue = GetOneNewsReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>标题</strong>: " & Title
  704. GetOneNewsReturnValue = GetOneNewsReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>新闻链接</strong>: <a target=""_blank"" href=""" & LinkStr & """>" & LinkStr & "</a><br>"
  705. Case 4 '成功保存
  706. GetOneNewsReturnValue = "</br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>序号</strong>: " & NewsIndex
  707. GetOneNewsReturnValue = GetOneNewsReturnValue & "&nbsp;&nbsp;&nbsp;&nbsp;<strong>结果</strong>: 采集成功"
  708. GetOneNewsReturnValue = GetOneNewsReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>标题</strong>: " & Title
  709. GetOneNewsReturnValue = GetOneNewsReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>内容</strong>: " & Left(LoseHtml(Content),30) & "&nbsp;&nbsp;......"
  710. GetOneNewsReturnValue = GetOneNewsReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>新闻链接</strong>: <a target=""_blank"" href=""" & LinkStr & """>" & LinkStr & "</a><br>"
  711. CollectOKNumber = CollectOKNumber + 1
  712. Case 5 '不能够读取新闻目标页面
  713. GetOneNewsReturnValue = "</br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>序号</strong>: " & NewsIndex
  714. GetOneNewsReturnValue = GetOneNewsReturnValue & "&nbsp;&nbsp;&nbsp;&nbsp;<strong>结果</strong>: <font color=red>不能够读取新闻目标页面</font>"
  715. GetOneNewsReturnValue = GetOneNewsReturnValue & "<br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>新闻链接</strong>: <a target=""_blank"" href=""" & LinkStr & """>" & LinkStr & "</a><br>"
  716. Case else
  717. End Select
  718. End Function
  719. Function SaveCollectContent(Title,Links,Content,Author,SourceString,AddDate)
  720. Dim RsNewsObj,RsTempObj
  721. Set RsNewsObj = Server.CreateObject("Adodb.RecordSet")
  722. RsNewsObj.Open "Select * from FS_News where 1=0",CollectConn,3,3
  723. RsNewsObj.AddNew
  724. RsNewsObj("Title") = LoseHtml(Title)
  725. RsNewsObj("Links") = Links
  726. RsNewsObj("Content") = Content
  727. RsNewsObj("ContentLength") = Len(Content)
  728. RsNewsObj("AddDate") = AddDate
  729. RsNewsObj("ImagesCount") = 0
  730. RsNewsObj("SiteID") = CollectingSiteID
  731. RsNewsObj("Author") = Left(Author,200)
  732. RsNewsObj("IsLock") = 0
  733. RsNewsObj("History") = 0
  734. RsNewsObj("Source") = Left(SourceString,200)
  735. RsNewsObj("ReviewTF") = 0
  736. RsNewsObj.UpDate
  737. RsNewsObj.Close
  738. Set RsNewsObj = Nothing
  739. End Function
  740. Function ReplaceKeyWords(Content)
  741. Dim RsRuleObj,HeadSeting,FootSeting,ReContent,regEx
  742. Set RsRuleObj = CollectConn.Execute("Select * from FS_Rule where SiteID=" & CollectingSiteID)
  743. do while Not RsRuleObj.Eof
  744. HeadSeting = RsRuleObj("HeadSeting")
  745. FootSeting = RsRuleObj("FootSeting")
  746. ReContent = RsRuleObj("ReContent")
  747. if IsNull(FootSeting) or FootSeting = "" then
  748. if HeadSeting <> "" then
  749. Content = Replace(Content,HeadSeting,ReContent)
  750. end if
  751. end if
  752. if Not IsNull(FootSeting) and FootSeting <> "" and Not IsNull(HeadSeting) and HeadSeting <> ""  then
  753. Set regEx = New RegExp
  754. regEx.Pattern = HeadSeting & "[^]*" & FootSeting
  755. regEx.IgnoreCase = False
  756. regEx.Global = True
  757. 'Dim Matches,Match,HaveTF,ShowStr
  758. 'HaveTF = False
  759. 'Set Matches = regEx.Execute(Content)
  760. 'For Each Match in Matches
  761. 'ShowStr = ShowStr & Match.Value & "<br>"
  762. 'HaveTF = True
  763. 'Next
  764. 'if HaveTF = True then
  765. 'Response.Write(ShowStr)
  766. 'Response.End
  767. 'end if
  768. if IsNull(ReContent) then
  769. Content = regEx.Replace(Content,"")
  770. else
  771. Content = regEx.Replace(Content,ReContent)
  772. end if
  773. Set regEx = Nothing
  774. end if
  775. RsRuleObj.MoveNext
  776. loop
  777. Set RsRuleObj = Nothing
  778. ReplaceKeyWords = Content
  779. End Function
  780. %>