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

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../../FS_Inc/Function.asp" -->
  5. <!--#include file="../../FS_Inc/Func_page.asp" -->
  6. <!--#include file="../../FS_InterFace/NS_Public.asp" -->
  7. <!--#include file="../../FS_InterFace/MS_Public.asp" -->
  8. <!--#include file="../../FS_InterFace/DS_Public.asp" -->
  9. <!--#include file="../../FS_InterFace/ME_Public.asp" -->
  10. <!--#include file="../../FS_InterFace/MF_Public.asp" -->
  11. <!--#include file="../../FS_InterFace/SD_Public.asp" -->
  12. <!--#include file="../../FS_InterFace/HS_Public.asp" -->
  13. <!--#include file="../../FS_InterFace/AP_Public.asp" -->
  14. <!--#include file="../../FS_InterFace/Other_Public.asp" -->
  15. <!--#include file="Public_Function.asp" -->
  16. <%
  17. 'Copyright (c) 2006 Foosun Inc. Code by Simpwind.Xie Time:2006.6
  18. Response.Buffer = True
  19. Response.Expires = -1
  20. Response.ExpiresAbsolute = Now() - 1
  21. Response.Expires = 0
  22. Response.CacheControl = "no-cache"
  23. Response.Charset="GB2312"
  24. Dim Conn,User_Conn,StrSql
  25. Dim p_Sys_ID,p_Sql,p_SYS_ROOT_DIR,p_Index,p_Count,f_Array,f_Action,f_type
  26. Dim p_Refresh_OK_TF
  27. MF_Default_Conn
  28. MF_User_Conn
  29. MF_Session_TF
  30. 'On Error Resume Next
  31. If G_VIRTUAL_ROOT_DIR = "" Then 
  32. p_SYS_ROOT_DIR = ""
  33. Else 
  34. p_SYS_ROOT_DIR = "/" & G_VIRTUAL_ROOT_DIR
  35. End If
  36. f_Action = Request("Action")
  37. If f_Action <> "" Then
  38. f_Array = Split(f_Action,"$")
  39. p_Sys_ID = f_Array(0)
  40. f_Type = f_Array(2)
  41. If Err Then
  42. Err.Clear
  43. Response.Write "No$$"
  44. Response.End()
  45. End If
  46. End If
  47. If f_Type = "index" Then 
  48. Response.Write Refresh_index(p_Sys_ID)
  49. Else
  50. p_Sql = Get_Sql
  51. if p_Sql <> "" then
  52. p_Refresh_OK_TF = Refresh_One_Record(p_Sql,True)
  53. If p_Refresh_OK_TF=True then
  54. If Err Then
  55. Response.Write "Err$"&p_Refresh_OK_TF(1)&"$"&Err.Description
  56. Response.End()
  57. Else
  58. Response.Write "Next$"&P_Count&"$"&p_Index+1
  59. End If
  60. ElseIf p_Refresh_OK_TF=False then
  61. If Err Then
  62. Response.Write "Err$"&Request.Cookies("COOKIES_REFRESH_FirstID")&"$"&Err.Description
  63. Response.End()
  64. Else
  65. Response.Write "End$"&P_Count&"$"&p_Index+1
  66. End If
  67. Else
  68. Response.Write "Err$"&Request.Cookies("COOKIES_REFRESH_FirstID")&"$"&Err.Description
  69. End If
  70. else
  71. If Err Then
  72. Response.Write "Err$"&p_Index&"$"&Err.Description
  73. Response.End()
  74. Else
  75. Response.Write "No$$"
  76. End If
  77. end if
  78. end if
  79. 'stat$P_Count$P_Index
  80. 'stat;MF,Next,End,No
  81. User_Conn.Close
  82. Set User_Conn = Nothing
  83. Conn.Close
  84. Set Conn = Nothing
  85. Function Refresh_index(Sys_flag)
  86. Dim patrn(1),strng,f_PLACE_OBJ,p_HTML_File_Save_Path_Str,p_HTML_File_Save_Phy_Path_Str
  87. Dim p_FSO_OBJ,p_FILE_OBJ,p_FILE_STREAM_OBJ,p_File_Content,p_INDEX_DIC_OBJ,p_Templet,p_Phy_Templet,p_FileName
  88. patrn(0)="</head>"
  89. patrn(1)="<body"
  90. strng=Get_JS_CopyRight("NewsId")
  91. if Request.Cookies("FoosunSUBCookie")("FoosunSUB" & Sys_flag) = "1" then
  92. Select Case Sys_flag
  93. Case "NS"
  94. If Request.Cookies("FoosunNSCookies")("FoosunNSNewsDir")="" Then
  95. NSConfig_Cookies
  96. End If
  97. p_Templet = p_SYS_ROOT_DIR & Request.Cookies("FoosunNSCookies")("FoosunNSIndexTemplet")
  98. p_HTML_File_Save_Path_Str = p_SYS_ROOT_DIR & "/" & Request.Cookies("FoosunNSCookies")("FoosunNSNewsDir") 
  99. p_FileName=Request.Cookies("FoosunNSCookies")("FoosunNSIndexPage")
  100. Case "DS"
  101. If Request.Cookies("FoosunDSCookies")("FoosunDSDownDir")="" Then
  102. DSConfig_Cookies
  103. End If
  104. p_Templet = p_SYS_ROOT_DIR & Request.Cookies("FoosunDSCookies")("FoosunDSIndexTemplet")
  105. p_HTML_File_Save_Path_Str = p_SYS_ROOT_DIR & "/"& Request.Cookies("FoosunDSCookies")("FoosunDSDownDir")
  106. p_FileName=Request.Cookies("FoosunDSCookies")("FoosunDSIndexPage")
  107. Case "MS"
  108. If Request.Cookies("FoosunMSCookies")("FoosunMSDir")="" Then
  109. MSConfig_Cookies
  110. End If
  111. p_Templet = p_SYS_ROOT_DIR & Request.Cookies("FoosunMSCookies")("FoosunMSIndexTemplet")
  112. p_HTML_File_Save_Path_Str = p_SYS_ROOT_DIR & "/"& Request.Cookies("FoosunMSCookies")("FoosunMSDir")
  113. p_FileName="index.htm"
  114. Case "MF"
  115. If Request.Cookies("FoosunMFCookies")("FoosunMFIndexTemplet")="" Then
  116. MFConfig_Cookies
  117. End If
  118. p_Templet = p_SYS_ROOT_DIR & Request.Cookies("FoosunMFCookies")("FoosunMFIndexTemplet")
  119. p_HTML_File_Save_Path_Str = p_SYS_ROOT_DIR
  120. p_FileName=Request.Cookies("FoosunMFCookies")("FoosunMFIndexFileName")
  121. Case Else
  122. Refresh_index="No$$"
  123. Exit Function
  124. End Select
  125. Else
  126. Refresh_index="No$$"
  127. Exit Function
  128. End If
  129. If p_Templet="" Then
  130. p_Phy_Templet=""
  131. ELse
  132. p_Phy_Templet = Server.MapPath(p_Templet)
  133. End If
  134. Set p_FSO_OBJ = Server.CreateObject(G_FS_FSO)
  135. If p_FSO_OBJ.FileExists(p_Phy_Templet) = False Then 
  136. p_File_Content = "模板不存在,请添加模板后再生成!"
  137. Else 
  138. Set p_FILE_OBJ = p_FSO_OBJ.GetFile(p_Phy_Templet)
  139. Set p_FILE_STREAM_OBJ = p_FILE_OBJ.OpenAsTextStream(1)
  140. If Not p_FILE_STREAM_OBJ.AtEndOfStream Then 
  141. p_File_Content = p_FILE_STREAM_OBJ.ReadAll
  142. Else 
  143. p_File_Content = "模板内容为空"
  144. End If 
  145. End If 
  146. Set p_FILE_STREAM_OBJ = Nothing
  147. Set p_FILE_OBJ = Nothing
  148. Set p_FSO_OBJ = Nothing
  149. Set p_INDEX_DIC_OBJ = Replace_All_Flag(p_File_Content,"",Sys_flag)
  150. p_File_Content = p_INDEX_DIC_OBJ.Item("-3")
  151. Set p_INDEX_DIC_OBJ = Nothing
  152. If p_HTML_File_Save_Path_Str<>"" Then
  153. p_HTML_File_Save_Phy_Path_Str = Server.MapPath(p_HTML_File_Save_Path_Str)
  154. CreatePath p_HTML_File_Save_Phy_Path_Str,Server.MapPath("/")
  155. End If
  156. Rem 建立正则对象
  157. Set f_PLACE_OBJ = New RegExp
  158. Rem ============
  159. Rem 加入版权信息和关键JS文件(正则搜索)
  160. f_PLACE_OBJ.Pattern = patrn(0)
  161. f_PLACE_OBJ.IgnoreCase = True
  162. f_PLACE_OBJ.Global = False
  163. f_PLACE_OBJ.Multiline = True
  164. If f_PLACE_OBJ.Test(p_File_Content) Then
  165. p_File_Content=f_PLACE_OBJ.Replace(p_File_Content,patrn(0)&vbNewLine&strng)
  166. Else
  167. f_PLACE_OBJ.Pattern = patrn(1)
  168. If f_PLACE_OBJ.Test(p_File_Content) Then
  169. p_File_Content=f_PLACE_OBJ.Replace(p_File_Content,patrn(1)&vbNewLine&strng)
  170. Else
  171. p_File_Content=strng&vbNewLine&p_File_Content
  172. End If
  173. End If
  174. Rem ===================================
  175. AllSaveFile p_File_Content,p_HTML_File_Save_Path_Str&"/"&p_FileName
  176. If Err Then
  177. Response.Write "Err$1$"&Err.Description
  178. Response.End()
  179. ElseIf Sys_flag="MF" Then
  180. Response.write Sys_flag&"$1$2"
  181. Else
  182. Response.write "End$1$2"
  183. End If
  184. End Function
  185. Function Get_Sql()
  186. Dim f_startId,f_endId,f_LastNews,f_startTime,f_endTime,f_ClassID,f_First_ID,f_Record_Count
  187. Dim f_Operating_ClassID,f_Index,f_Public_Sql_Head,f_Sql,f_Count_Sql,f_Last_Type_Record_Count
  188. Dim f_Table,f_Para_Cont_In_Action,f_Where,f_Paras_Array,f_ID,f_Temp_Array_1,f_Temp_Array_2
  189. Dim Rs_Temp,Str_ID
  190. Str_ID="ID"
  191. If f_Action<>"" Then
  192. f_Table = f_Array(1)
  193. f_Para_Cont_In_Action = f_Array(3)
  194. f_Paras_Array = Split(f_Para_Cont_In_Action,";")
  195. Select Case p_Sys_ID
  196. Case "NS"
  197. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"news")
  198. Select Case f_Type
  199. Case "nsallnews"
  200. f_Where = ""
  201. f_Where = f_Where+" and A.isURL=0 and isdraft=0 and isRecyle=0 and isLock=0 and A.ClassID in (Select ClassID From FS_NS_NewsClass)"
  202. Case "nsidnews"
  203. if UBound(f_Paras_Array) = 1 then
  204. f_Temp_Array_1 = Split(f_Paras_Array(0),":")
  205. f_Temp_Array_2 = Split(f_Paras_Array(1),":")
  206. if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
  207. f_Where = " And A.ID Between " & f_Temp_Array_1(1) & " And " & f_Temp_Array_2(1)
  208. else
  209. f_Where = " And 1=0 "
  210. end if
  211. else
  212. f_Where = " And 1=0 "
  213. end if
  214. f_Where = f_Where+" and A.isURL=0 and isdraft=0 and isRecyle=0 and isLock=0 and A.ClassID in (Select ClassID From FS_NS_NewsClass)"
  215. Case "nslastnews"
  216. f_Where = ""
  217. f_Where = f_Where+" and A.isURL=0 and isdraft=0 and isRecyle=0 and isLock=0 and A.ClassID in (Select ClassID From FS_NS_NewsClass)"
  218. Case "nsdatenews"
  219. if UBound(f_Paras_Array) = 1 then
  220. f_Temp_Array_1 = Split(f_Paras_Array(0),":")
  221. f_Temp_Array_2 = Split(f_Paras_Array(1),":")
  222. if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
  223. If G_IS_SQL_DB=0 Then
  224. f_Where = " And A.addtime Between #" & f_Temp_Array_1(1) & "# And #" & f_Temp_Array_2(1) & "#"
  225. Else
  226. f_Where = " And A.addtime Between '" & f_Temp_Array_1(1) & "' And '" & f_Temp_Array_2(1) & "'"
  227. End If
  228. else
  229. f_Where = " And 1=0 "
  230. end if
  231. else
  232. f_Where = " And 1=0 "
  233. end if
  234. f_Where = f_Where+" and A.isURL=0 and isdraft=0 and isRecyle=0 and isLock=0 and A.ClassID in (Select ClassID From FS_NS_NewsClass)"
  235. Case "nsclassnews"
  236. f_ID = Split(f_Paras_Array(0),":")(1)
  237. f_ID = "'" & Replace(f_ID,"*","','") & "'"
  238. f_Where = " And A.ClassID in (" & f_ID & ")"
  239. f_Where = f_Where+" and A.isURL=0 and isdraft=0 and isRecyle=0 and isLock=0 and A.ClassID in (Select ClassID From FS_NS_NewsClass)"
  240. Case "nsallclass"
  241. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
  242. f_Where = ""
  243. f_Where = f_Where+" and A.isURL=0 and ReycleTF=0 and A.ClassID in (Select ClassID From FS_NS_NewsClass)"
  244. Case "nsclass"
  245. f_ID = Split(f_Paras_Array(0),":")(1)
  246. f_ID = "'" & Replace(f_ID,"*","','") & "'"
  247. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
  248. f_Where = " And A.ClassID in (" & f_ID & ")"
  249. f_Where = f_Where+" and A.isURL=0 and ReycleTF=0"
  250. Case "nsspecial"
  251. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"special")
  252. f_ID = Split(f_Paras_Array(0),":")(1)
  253. if f_ID <> "" then
  254. f_ID = Replace(f_ID,"*",",")
  255. f_Where = " And A.specialID in (" & f_ID & ")"
  256. else
  257. f_Where = " and 1=0"
  258. End If
  259. Str_ID="specialID"
  260. f_Where = f_Where+" and isLock=0"
  261. Case Else
  262. f_Where = " And 1=0"
  263. End Select
  264. Case "MS"
  265. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"product")
  266. Select Case f_Type
  267. Case "msallproduct"
  268. f_Where = ""
  269. Case "msidproduct"
  270. if UBound(f_Paras_Array) = 1 then
  271. f_Temp_Array_1 = Split(f_Paras_Array(0),":")
  272. f_Temp_Array_2 = Split(f_Paras_Array(1),":")
  273. if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
  274. f_Where = " And A.ID Between " & Split(f_Paras_Array(0),":")(1) & " And " & Split(f_Paras_Array(1),":")(1)
  275. else
  276. f_Where = " And 1=0 "
  277. end if
  278. else
  279. f_Where = " And 1=0 "
  280. end if
  281. Case "mslastproduct"
  282. f_Where = ""
  283. Case "msdateproduct"
  284. if UBound(f_Paras_Array) = 1 then
  285. f_Temp_Array_1 = Split(f_Paras_Array(0),":")
  286. f_Temp_Array_2 = Split(f_Paras_Array(1),":")
  287. if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
  288. If G_IS_SQL_DB=0 Then
  289. f_Where = " And A.addtime Between #" & Split(f_Paras_Array(0),":")(1) & "# And #" & Split(f_Paras_Array(1),":")(1)&"#"
  290. Else
  291. f_Where = " And A.addtime Between '" & Split(f_Paras_Array(0),":")(1) & "' And '" & Split(f_Paras_Array(1),":")(1)&"'"
  292. End if
  293. else
  294. f_Where = " And 1=0 "
  295. end if
  296. else
  297. f_Where = " And 1=0 "
  298. end if
  299. Case "msclassproduct"
  300. f_ID = Split(f_Paras_Array(0),":")(1)
  301. f_ID = "'" & Replace(f_ID,"*","','") & "'"
  302. f_Where = " And A.ClassID in (" & f_ID & ")"
  303. Case "msallclass"
  304. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
  305. f_Where = ""
  306. Case "msclass"
  307. f_ID = Split(f_Paras_Array(0),":")(1)
  308. f_ID = "'" & Replace(f_ID,"*","','") & "'"
  309. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
  310. f_Where = " And A.ClassID in (" & f_ID & ")"
  311. Case "msspecial"
  312. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"special")
  313. f_ID = Split(f_Paras_Array(0),":")(1)
  314. if f_ID <> "" then
  315. f_ID = Replace(f_ID,"*",",")
  316. f_Where = " And A.specialID in (" & f_ID & ")"
  317. else
  318. f_Where = " And 1=0"
  319. end If
  320. Str_ID="specialID"
  321. Case Else
  322. f_Where = " And 1=0"
  323. End Select
  324. Case "DS"
  325. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"download")
  326. Select Case f_Type
  327. Case "dsalldownload"
  328. f_Where = ""
  329. Case "dsiddownload"
  330. if UBound(f_Paras_Array) = 1 then
  331. f_Temp_Array_1 = Split(f_Paras_Array(0),":")
  332. f_Temp_Array_2 = Split(f_Paras_Array(1),":")
  333. if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
  334. f_Where = " And A.ID Between " & Split(f_Paras_Array(0),":")(1) & " And " & Split(f_Paras_Array(1),":")(1)
  335. else
  336. f_Where = " And 1=0 "
  337. end if
  338. else
  339. f_Where = " And 1=0 "
  340. end if
  341. Case "dslastdownload"
  342. f_Where = ""
  343. Case "dsdatedownload"
  344. if UBound(f_Paras_Array) = 1 then
  345. f_Temp_Array_1 = Split(f_Paras_Array(0),":")
  346. f_Temp_Array_2 = Split(f_Paras_Array(1),":")
  347. if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
  348. If G_IS_SQL_DB=0 Then
  349. f_Where = " And A.addtime Between #" & Split(f_Paras_Array(0),":")(1) & "# And #" & Split(f_Paras_Array(1),":")(1)&"#"
  350. Else
  351. f_Where = " And A.addtime Between '" & Split(f_Paras_Array(0),":")(1) & "' And '" & Split(f_Paras_Array(1),":")(1)&"'"
  352. End If
  353. else
  354. f_Where = " And 1=0 "
  355. end if
  356. else
  357. f_Where = " And 1=0 "
  358. end if
  359. Case "dsclassdownload"
  360. f_ID = Split(f_Paras_Array(0),":")(1)
  361. f_ID = "'" & Replace(f_ID,"*","','") & "'"
  362. f_Where = " And A.ClassID in (" & f_ID & ")"
  363. Case "dsallclass"
  364. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
  365. f_Where = ""
  366. Case "dsclass"
  367. f_ID = Split(f_Paras_Array(0),":")(1)
  368. f_ID = "'" & Replace(f_ID,"*","','") & "'"
  369. f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
  370. f_Where = " And A.ClassID in (" & f_ID & ")"
  371. Case Else
  372. f_Where = " And 1=0"
  373. End Select
  374. Case Else
  375. f_Public_Sql_Head = ""
  376. f_Where = " And 1=0"
  377. End Select
  378. StrSql="Select Count(*),max("&Str_ID&") from " & f_Table & " as A where 1=1" & f_Where
  379. 'Response.Write StrSql
  380. Set Rs_Temp = Conn.Execute(StrSql)
  381. f_Record_Count = Rs_Temp(0)
  382. If f_Record_Count=0 Then
  383. f_Record_Count=0
  384. Else
  385. f_First_ID = Rs_Temp(1)+1
  386. End If
  387. 'Response.Write f_Record_Count
  388. if Instr(f_Type,"last") <> 0 then
  389. f_Last_Type_Record_Count = Split(f_Paras_Array(0),":")(1)
  390. if f_Last_Type_Record_Count = "" then 
  391. f_Record_Count = 0
  392. else
  393. If Not IsNumeric(f_Last_Type_Record_Count) Then
  394. f_Record_Count = 10
  395. ElseIf f_Record_Count>CLng(f_Last_Type_Record_Count) Then
  396. f_Record_Count = CLng(f_Last_Type_Record_Count)
  397. End If
  398. end if
  399. end If
  400. Response.Cookies("COOKIES_REFRESH_NewsCount") = f_Record_Count
  401. Response.Cookies("COOKIES_REFRESH_Index") = 0
  402. Response.Cookies("COOKIES_REFRESH_FirstID") = f_First_ID
  403. Response.Cookies("COOKIES_REFRESH_Where") = f_Where
  404. Response.Cookies("COOKIES_REFRESH_IDFlag") = Str_ID
  405. Response.Cookies("COOKIES_REFRESH_SqlHead") = f_Public_Sql_Head
  406. End If
  407. f_Record_Count = Request.Cookies("COOKIES_REFRESH_NewsCount")
  408. f_Index = Request.Cookies("COOKIES_REFRESH_Index")
  409. f_First_ID = Request.Cookies("COOKIES_REFRESH_FirstID")
  410. f_Where = Request.Cookies("COOKIES_REFRESH_Where")
  411. Str_ID = Request.Cookies("COOKIES_REFRESH_IDFlag")
  412. f_Public_Sql_Head = Request.Cookies("COOKIES_REFRESH_SqlHead")
  413. If f_Record_Count="" Then
  414. f_Record_Count="0"
  415. End If
  416. If CLng(f_Record_Count)=0 Then
  417. Get_Sql=""
  418. Response.Cookies("COOKIES_REFRESH_NewsCount") = ""
  419. Response.Cookies("COOKIES_REFRESH_Index") = ""
  420. Response.Cookies("COOKIES_REFRESH_FirstID") = ""
  421. Response.Cookies("COOKIES_REFRESH_Where") = ""
  422. Else
  423. If CLng(f_Index)+1 <= CLng(f_Record_Count) then
  424. Get_Sql = f_Public_Sql_Head & f_Where & " And A."&Str_ID&"<" & f_First_ID & " Order by A."&Str_ID&" Desc"
  425. Response.Cookies("COOKIES_REFRESH_Index") = f_Index + 1
  426. else
  427. Get_Sql = f_Public_Sql_Head & f_Where & " And 1=0"
  428. Response.Cookies("COOKIES_REFRESH_NewsCount") = ""
  429. Response.Cookies("COOKIES_REFRESH_Index") = ""
  430. Response.Cookies("COOKIES_REFRESH_FirstID") = ""
  431. Response.Cookies("COOKIES_REFRESH_Where") = ""
  432. end if
  433. End If
  434. p_Index = f_Index
  435. p_Count = f_Record_Count
  436. End Function
  437. %>