Public_Refresh.asp
资源名称:eat.rar [点击查看]
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:16k
源码类别:
数据库编程
开发平台:
ASP/ASPX
- <% Option Explicit %>
- <!--#include file="../../FS_Inc/Const.asp" -->
- <!--#include file="../../FS_InterFace/MF_Function.asp" -->
- <!--#include file="../../FS_Inc/Function.asp" -->
- <!--#include file="../../FS_Inc/Func_page.asp" -->
- <!--#include file="../../FS_InterFace/NS_Public.asp" -->
- <!--#include file="../../FS_InterFace/MS_Public.asp" -->
- <!--#include file="../../FS_InterFace/DS_Public.asp" -->
- <!--#include file="../../FS_InterFace/ME_Public.asp" -->
- <!--#include file="../../FS_InterFace/MF_Public.asp" -->
- <!--#include file="../../FS_InterFace/SD_Public.asp" -->
- <!--#include file="../../FS_InterFace/HS_Public.asp" -->
- <!--#include file="../../FS_InterFace/AP_Public.asp" -->
- <!--#include file="../../FS_InterFace/Other_Public.asp" -->
- <!--#include file="Public_Function.asp" -->
- <%
- 'Copyright (c) 2006 Foosun Inc. Code by Simpwind.Xie Time:2006.6
- Response.Buffer = True
- Response.Expires = -1
- Response.ExpiresAbsolute = Now() - 1
- Response.Expires = 0
- Response.CacheControl = "no-cache"
- Response.Charset="GB2312"
- Dim Conn,User_Conn,StrSql
- Dim p_Sys_ID,p_Sql,p_SYS_ROOT_DIR,p_Index,p_Count,f_Array,f_Action,f_type
- Dim p_Refresh_OK_TF
- MF_Default_Conn
- MF_User_Conn
- MF_Session_TF
- 'On Error Resume Next
- If G_VIRTUAL_ROOT_DIR = "" Then
- p_SYS_ROOT_DIR = ""
- Else
- p_SYS_ROOT_DIR = "/" & G_VIRTUAL_ROOT_DIR
- End If
- f_Action = Request("Action")
- If f_Action <> "" Then
- f_Array = Split(f_Action,"$")
- p_Sys_ID = f_Array(0)
- f_Type = f_Array(2)
- If Err Then
- Err.Clear
- Response.Write "No$$"
- Response.End()
- End If
- End If
- If f_Type = "index" Then
- Response.Write Refresh_index(p_Sys_ID)
- Else
- p_Sql = Get_Sql
- if p_Sql <> "" then
- p_Refresh_OK_TF = Refresh_One_Record(p_Sql,True)
- If p_Refresh_OK_TF=True then
- If Err Then
- Response.Write "Err$"&p_Refresh_OK_TF(1)&"$"&Err.Description
- Response.End()
- Else
- Response.Write "Next$"&P_Count&"$"&p_Index+1
- End If
- ElseIf p_Refresh_OK_TF=False then
- If Err Then
- Response.Write "Err$"&Request.Cookies("COOKIES_REFRESH_FirstID")&"$"&Err.Description
- Response.End()
- Else
- Response.Write "End$"&P_Count&"$"&p_Index+1
- End If
- Else
- Response.Write "Err$"&Request.Cookies("COOKIES_REFRESH_FirstID")&"$"&Err.Description
- End If
- else
- If Err Then
- Response.Write "Err$"&p_Index&"$"&Err.Description
- Response.End()
- Else
- Response.Write "No$$"
- End If
- end if
- end if
- 'stat$P_Count$P_Index
- 'stat;MF,Next,End,No
- User_Conn.Close
- Set User_Conn = Nothing
- Conn.Close
- Set Conn = Nothing
- Function Refresh_index(Sys_flag)
- Dim patrn(1),strng,f_PLACE_OBJ,p_HTML_File_Save_Path_Str,p_HTML_File_Save_Phy_Path_Str
- 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
- patrn(0)="</head>"
- patrn(1)="<body"
- strng=Get_JS_CopyRight("NewsId")
- if Request.Cookies("FoosunSUBCookie")("FoosunSUB" & Sys_flag) = "1" then
- Select Case Sys_flag
- Case "NS"
- If Request.Cookies("FoosunNSCookies")("FoosunNSNewsDir")="" Then
- NSConfig_Cookies
- End If
- p_Templet = p_SYS_ROOT_DIR & Request.Cookies("FoosunNSCookies")("FoosunNSIndexTemplet")
- p_HTML_File_Save_Path_Str = p_SYS_ROOT_DIR & "/" & Request.Cookies("FoosunNSCookies")("FoosunNSNewsDir")
- p_FileName=Request.Cookies("FoosunNSCookies")("FoosunNSIndexPage")
- Case "DS"
- If Request.Cookies("FoosunDSCookies")("FoosunDSDownDir")="" Then
- DSConfig_Cookies
- End If
- p_Templet = p_SYS_ROOT_DIR & Request.Cookies("FoosunDSCookies")("FoosunDSIndexTemplet")
- p_HTML_File_Save_Path_Str = p_SYS_ROOT_DIR & "/"& Request.Cookies("FoosunDSCookies")("FoosunDSDownDir")
- p_FileName=Request.Cookies("FoosunDSCookies")("FoosunDSIndexPage")
- Case "MS"
- If Request.Cookies("FoosunMSCookies")("FoosunMSDir")="" Then
- MSConfig_Cookies
- End If
- p_Templet = p_SYS_ROOT_DIR & Request.Cookies("FoosunMSCookies")("FoosunMSIndexTemplet")
- p_HTML_File_Save_Path_Str = p_SYS_ROOT_DIR & "/"& Request.Cookies("FoosunMSCookies")("FoosunMSDir")
- p_FileName="index.htm"
- Case "MF"
- If Request.Cookies("FoosunMFCookies")("FoosunMFIndexTemplet")="" Then
- MFConfig_Cookies
- End If
- p_Templet = p_SYS_ROOT_DIR & Request.Cookies("FoosunMFCookies")("FoosunMFIndexTemplet")
- p_HTML_File_Save_Path_Str = p_SYS_ROOT_DIR
- p_FileName=Request.Cookies("FoosunMFCookies")("FoosunMFIndexFileName")
- Case Else
- Refresh_index="No$$"
- Exit Function
- End Select
- Else
- Refresh_index="No$$"
- Exit Function
- End If
- If p_Templet="" Then
- p_Phy_Templet=""
- ELse
- p_Phy_Templet = Server.MapPath(p_Templet)
- End If
- Set p_FSO_OBJ = Server.CreateObject(G_FS_FSO)
- If p_FSO_OBJ.FileExists(p_Phy_Templet) = False Then
- p_File_Content = "模板不存在,请添加模板后再生成!"
- Else
- Set p_FILE_OBJ = p_FSO_OBJ.GetFile(p_Phy_Templet)
- Set p_FILE_STREAM_OBJ = p_FILE_OBJ.OpenAsTextStream(1)
- If Not p_FILE_STREAM_OBJ.AtEndOfStream Then
- p_File_Content = p_FILE_STREAM_OBJ.ReadAll
- Else
- p_File_Content = "模板内容为空"
- End If
- End If
- Set p_FILE_STREAM_OBJ = Nothing
- Set p_FILE_OBJ = Nothing
- Set p_FSO_OBJ = Nothing
- Set p_INDEX_DIC_OBJ = Replace_All_Flag(p_File_Content,"",Sys_flag)
- p_File_Content = p_INDEX_DIC_OBJ.Item("-3")
- Set p_INDEX_DIC_OBJ = Nothing
- If p_HTML_File_Save_Path_Str<>"" Then
- p_HTML_File_Save_Phy_Path_Str = Server.MapPath(p_HTML_File_Save_Path_Str)
- CreatePath p_HTML_File_Save_Phy_Path_Str,Server.MapPath("/")
- End If
- Rem 建立正则对象
- Set f_PLACE_OBJ = New RegExp
- Rem ============
- Rem 加入版权信息和关键JS文件(正则搜索)
- f_PLACE_OBJ.Pattern = patrn(0)
- f_PLACE_OBJ.IgnoreCase = True
- f_PLACE_OBJ.Global = False
- f_PLACE_OBJ.Multiline = True
- If f_PLACE_OBJ.Test(p_File_Content) Then
- p_File_Content=f_PLACE_OBJ.Replace(p_File_Content,patrn(0)&vbNewLine&strng)
- Else
- f_PLACE_OBJ.Pattern = patrn(1)
- If f_PLACE_OBJ.Test(p_File_Content) Then
- p_File_Content=f_PLACE_OBJ.Replace(p_File_Content,patrn(1)&vbNewLine&strng)
- Else
- p_File_Content=strng&vbNewLine&p_File_Content
- End If
- End If
- Rem ===================================
- AllSaveFile p_File_Content,p_HTML_File_Save_Path_Str&"/"&p_FileName
- If Err Then
- Response.Write "Err$1$"&Err.Description
- Response.End()
- ElseIf Sys_flag="MF" Then
- Response.write Sys_flag&"$1$2"
- Else
- Response.write "End$1$2"
- End If
- End Function
- Function Get_Sql()
- Dim f_startId,f_endId,f_LastNews,f_startTime,f_endTime,f_ClassID,f_First_ID,f_Record_Count
- Dim f_Operating_ClassID,f_Index,f_Public_Sql_Head,f_Sql,f_Count_Sql,f_Last_Type_Record_Count
- Dim f_Table,f_Para_Cont_In_Action,f_Where,f_Paras_Array,f_ID,f_Temp_Array_1,f_Temp_Array_2
- Dim Rs_Temp,Str_ID
- Str_ID="ID"
- If f_Action<>"" Then
- f_Table = f_Array(1)
- f_Para_Cont_In_Action = f_Array(3)
- f_Paras_Array = Split(f_Para_Cont_In_Action,";")
- Select Case p_Sys_ID
- Case "NS"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"news")
- Select Case f_Type
- Case "nsallnews"
- f_Where = ""
- 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)"
- Case "nsidnews"
- if UBound(f_Paras_Array) = 1 then
- f_Temp_Array_1 = Split(f_Paras_Array(0),":")
- f_Temp_Array_2 = Split(f_Paras_Array(1),":")
- if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
- f_Where = " And A.ID Between " & f_Temp_Array_1(1) & " And " & f_Temp_Array_2(1)
- else
- f_Where = " And 1=0 "
- end if
- else
- f_Where = " And 1=0 "
- end if
- 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)"
- Case "nslastnews"
- f_Where = ""
- 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)"
- Case "nsdatenews"
- if UBound(f_Paras_Array) = 1 then
- f_Temp_Array_1 = Split(f_Paras_Array(0),":")
- f_Temp_Array_2 = Split(f_Paras_Array(1),":")
- if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
- If G_IS_SQL_DB=0 Then
- f_Where = " And A.addtime Between #" & f_Temp_Array_1(1) & "# And #" & f_Temp_Array_2(1) & "#"
- Else
- f_Where = " And A.addtime Between '" & f_Temp_Array_1(1) & "' And '" & f_Temp_Array_2(1) & "'"
- End If
- else
- f_Where = " And 1=0 "
- end if
- else
- f_Where = " And 1=0 "
- end if
- 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)"
- Case "nsclassnews"
- f_ID = Split(f_Paras_Array(0),":")(1)
- f_ID = "'" & Replace(f_ID,"*","','") & "'"
- f_Where = " And A.ClassID in (" & f_ID & ")"
- 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)"
- Case "nsallclass"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
- f_Where = ""
- f_Where = f_Where+" and A.isURL=0 and ReycleTF=0 and A.ClassID in (Select ClassID From FS_NS_NewsClass)"
- Case "nsclass"
- f_ID = Split(f_Paras_Array(0),":")(1)
- f_ID = "'" & Replace(f_ID,"*","','") & "'"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
- f_Where = " And A.ClassID in (" & f_ID & ")"
- f_Where = f_Where+" and A.isURL=0 and ReycleTF=0"
- Case "nsspecial"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"special")
- f_ID = Split(f_Paras_Array(0),":")(1)
- if f_ID <> "" then
- f_ID = Replace(f_ID,"*",",")
- f_Where = " And A.specialID in (" & f_ID & ")"
- else
- f_Where = " and 1=0"
- End If
- Str_ID="specialID"
- f_Where = f_Where+" and isLock=0"
- Case Else
- f_Where = " And 1=0"
- End Select
- Case "MS"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"product")
- Select Case f_Type
- Case "msallproduct"
- f_Where = ""
- Case "msidproduct"
- if UBound(f_Paras_Array) = 1 then
- f_Temp_Array_1 = Split(f_Paras_Array(0),":")
- f_Temp_Array_2 = Split(f_Paras_Array(1),":")
- if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
- f_Where = " And A.ID Between " & Split(f_Paras_Array(0),":")(1) & " And " & Split(f_Paras_Array(1),":")(1)
- else
- f_Where = " And 1=0 "
- end if
- else
- f_Where = " And 1=0 "
- end if
- Case "mslastproduct"
- f_Where = ""
- Case "msdateproduct"
- if UBound(f_Paras_Array) = 1 then
- f_Temp_Array_1 = Split(f_Paras_Array(0),":")
- f_Temp_Array_2 = Split(f_Paras_Array(1),":")
- if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
- If G_IS_SQL_DB=0 Then
- f_Where = " And A.addtime Between #" & Split(f_Paras_Array(0),":")(1) & "# And #" & Split(f_Paras_Array(1),":")(1)&"#"
- Else
- f_Where = " And A.addtime Between '" & Split(f_Paras_Array(0),":")(1) & "' And '" & Split(f_Paras_Array(1),":")(1)&"'"
- End if
- else
- f_Where = " And 1=0 "
- end if
- else
- f_Where = " And 1=0 "
- end if
- Case "msclassproduct"
- f_ID = Split(f_Paras_Array(0),":")(1)
- f_ID = "'" & Replace(f_ID,"*","','") & "'"
- f_Where = " And A.ClassID in (" & f_ID & ")"
- Case "msallclass"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
- f_Where = ""
- Case "msclass"
- f_ID = Split(f_Paras_Array(0),":")(1)
- f_ID = "'" & Replace(f_ID,"*","','") & "'"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
- f_Where = " And A.ClassID in (" & f_ID & ")"
- Case "msspecial"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"special")
- f_ID = Split(f_Paras_Array(0),":")(1)
- if f_ID <> "" then
- f_ID = Replace(f_ID,"*",",")
- f_Where = " And A.specialID in (" & f_ID & ")"
- else
- f_Where = " And 1=0"
- end If
- Str_ID="specialID"
- Case Else
- f_Where = " And 1=0"
- End Select
- Case "DS"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"download")
- Select Case f_Type
- Case "dsalldownload"
- f_Where = ""
- Case "dsiddownload"
- if UBound(f_Paras_Array) = 1 then
- f_Temp_Array_1 = Split(f_Paras_Array(0),":")
- f_Temp_Array_2 = Split(f_Paras_Array(1),":")
- if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
- f_Where = " And A.ID Between " & Split(f_Paras_Array(0),":")(1) & " And " & Split(f_Paras_Array(1),":")(1)
- else
- f_Where = " And 1=0 "
- end if
- else
- f_Where = " And 1=0 "
- end if
- Case "dslastdownload"
- f_Where = ""
- Case "dsdatedownload"
- if UBound(f_Paras_Array) = 1 then
- f_Temp_Array_1 = Split(f_Paras_Array(0),":")
- f_Temp_Array_2 = Split(f_Paras_Array(1),":")
- if UBound(f_Temp_Array_1) = 1 And UBound(f_Temp_Array_2) = 1 then
- If G_IS_SQL_DB=0 Then
- f_Where = " And A.addtime Between #" & Split(f_Paras_Array(0),":")(1) & "# And #" & Split(f_Paras_Array(1),":")(1)&"#"
- Else
- f_Where = " And A.addtime Between '" & Split(f_Paras_Array(0),":")(1) & "' And '" & Split(f_Paras_Array(1),":")(1)&"'"
- End If
- else
- f_Where = " And 1=0 "
- end if
- else
- f_Where = " And 1=0 "
- end if
- Case "dsclassdownload"
- f_ID = Split(f_Paras_Array(0),":")(1)
- f_ID = "'" & Replace(f_ID,"*","','") & "'"
- f_Where = " And A.ClassID in (" & f_ID & ")"
- Case "dsallclass"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
- f_Where = ""
- Case "dsclass"
- f_ID = Split(f_Paras_Array(0),":")(1)
- f_ID = "'" & Replace(f_ID,"*","','") & "'"
- f_Public_Sql_Head = Get_Search_Sql_Head(p_Sys_ID,"class")
- f_Where = " And A.ClassID in (" & f_ID & ")"
- Case Else
- f_Where = " And 1=0"
- End Select
- Case Else
- f_Public_Sql_Head = ""
- f_Where = " And 1=0"
- End Select
- StrSql="Select Count(*),max("&Str_ID&") from " & f_Table & " as A where 1=1" & f_Where
- 'Response.Write StrSql
- Set Rs_Temp = Conn.Execute(StrSql)
- f_Record_Count = Rs_Temp(0)
- If f_Record_Count=0 Then
- f_Record_Count=0
- Else
- f_First_ID = Rs_Temp(1)+1
- End If
- 'Response.Write f_Record_Count
- if Instr(f_Type,"last") <> 0 then
- f_Last_Type_Record_Count = Split(f_Paras_Array(0),":")(1)
- if f_Last_Type_Record_Count = "" then
- f_Record_Count = 0
- else
- If Not IsNumeric(f_Last_Type_Record_Count) Then
- f_Record_Count = 10
- ElseIf f_Record_Count>CLng(f_Last_Type_Record_Count) Then
- f_Record_Count = CLng(f_Last_Type_Record_Count)
- End If
- end if
- end If
- Response.Cookies("COOKIES_REFRESH_NewsCount") = f_Record_Count
- Response.Cookies("COOKIES_REFRESH_Index") = 0
- Response.Cookies("COOKIES_REFRESH_FirstID") = f_First_ID
- Response.Cookies("COOKIES_REFRESH_Where") = f_Where
- Response.Cookies("COOKIES_REFRESH_IDFlag") = Str_ID
- Response.Cookies("COOKIES_REFRESH_SqlHead") = f_Public_Sql_Head
- End If
- f_Record_Count = Request.Cookies("COOKIES_REFRESH_NewsCount")
- f_Index = Request.Cookies("COOKIES_REFRESH_Index")
- f_First_ID = Request.Cookies("COOKIES_REFRESH_FirstID")
- f_Where = Request.Cookies("COOKIES_REFRESH_Where")
- Str_ID = Request.Cookies("COOKIES_REFRESH_IDFlag")
- f_Public_Sql_Head = Request.Cookies("COOKIES_REFRESH_SqlHead")
- If f_Record_Count="" Then
- f_Record_Count="0"
- End If
- If CLng(f_Record_Count)=0 Then
- Get_Sql=""
- Response.Cookies("COOKIES_REFRESH_NewsCount") = ""
- Response.Cookies("COOKIES_REFRESH_Index") = ""
- Response.Cookies("COOKIES_REFRESH_FirstID") = ""
- Response.Cookies("COOKIES_REFRESH_Where") = ""
- Else
- If CLng(f_Index)+1 <= CLng(f_Record_Count) then
- Get_Sql = f_Public_Sql_Head & f_Where & " And A."&Str_ID&"<" & f_First_ID & " Order by A."&Str_ID&" Desc"
- Response.Cookies("COOKIES_REFRESH_Index") = f_Index + 1
- else
- Get_Sql = f_Public_Sql_Head & f_Where & " And 1=0"
- Response.Cookies("COOKIES_REFRESH_NewsCount") = ""
- Response.Cookies("COOKIES_REFRESH_Index") = ""
- Response.Cookies("COOKIES_REFRESH_FirstID") = ""
- Response.Cookies("COOKIES_REFRESH_Where") = ""
- end if
- End If
- p_Index = f_Index
- p_Count = f_Record_Count
- End Function
- %>