Showpage_Ajax.asp
资源名称:eat.rar [点击查看]
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:5k
源码类别:
数据库编程
开发平台:
ASP/ASPX
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
- <% Option Explicit %>
- <!--#include file="FS_Inc/Const.asp" -->
- <!--#include file="FS_InterFace/MF_Function.asp" -->
- <!--#include file="FS_Inc/Function.asp" -->
- <%session.CodePage="936"%>
- <%
- Response.Buffer = True
- Response.Expires = -1
- Response.ExpiresAbsolute = Now() - 1
- Response.Expires = 0
- Response.CacheControl = "no-cache"
- response.Charset = "gb2312"
- Dim Conn,User_Conn,Page_Sql,Page_RS,strShowErr,Cookie_Domain
- Dim Server_Name,Server_V1,Server_V2
- Dim TmpStr,TmpArr,tmprs_,tmpStr1,TmpStr_2
- Dim stype,Id,PageType
- MF_Default_Conn
- Cookie_Domain = Get_MF_Domain()
- if Cookie_Domain="" then
- Cookie_Domain = "localhost"
- else
- if left(lcase(Cookie_Domain),len("http://"))="http://" then Cookie_Domain = mid(Cookie_Domain,len("http://")+1)
- if right(Cookie_Domain,1)="/" then Cookie_Domain = mid(Cookie_Domain,1,len(Cookie_Domain) - 1)
- end if
- ''防盗连
- Server_Name = Len(Request.ServerVariables("SERVER_NAME"))
- Server_V1 = Left(Replace(Cstr(Request.ServerVariables("HTTP_REFERER")),"http://",""),Server_Name)
- Server_V2 = Left(Cstr(Request.ServerVariables("SERVER_NAME")),Server_Name)
- if Server_V1 <> Server_V2 and Server_V1 <> "" and Server_V2 <> "" then
- response.Write("没有权限,请访问<a href=""http://"&Cookie_Domain&""">"&Cookie_Domain&"</a>.")
- response.End()
- end if
- stype = request.QueryString("type") 'NS
- Id = replace(request.QueryString("Id"),"'","") 'NewsId
- PageType = replace(request.QueryString("PageType"),"'","") 'PageType
- if stype="" then stype="NS"
- if Id="" then call response.Write("Error:Id is null!"):response.End()
- select case stype
- case "NS"
- '同时取栏目ID
- set tmprs_ = Conn.execute("select ID,ClassID from FS_NS_News where NewsID='"&Id&"'")
- if tmprs_.eof then
- TmpStr = "错误:不存在的新闻ID."
- else
- If PageType = "PrevPage" Then
- set Page_RS=Conn.execute("select top 1 ID,NewsID,NewsTitle from FS_NS_News where ID < "&tmprs_("ID")&" and ClassID='"&tmprs_("ClassID")&"' order by ID desc")
- if Page_RS.eof then
- TmpStr = "无"
- else
- if isnull(Page_RS("NewsTitle")) or Page_RS("NewsTitle")="" then
- TmpStr = "无标题!"
- else
- tmpStr1 = Page_RS("NewsTitle")
- TmpStr = "<a href="""&get_NewsLink(Page_RS("NewsID"))&""">"&tmpStr1&"</a>"
- end if
- end If
- Else
- ''''''''''''''''''''''''''''''''''''''''''
- set Page_RS=Conn.execute("select top 1 ID,NewsID,NewsTitle from FS_NS_News where ID > "&tmprs_("ID")&" and ClassID='"&tmprs_("ClassID")&"' order by ID")
- if Page_RS.eof then
- TmpStr = "无"
- else
- if isnull(Page_RS("NewsTitle")) or Page_RS("NewsTitle")="" then
- TmpStr= "无标题!"
- else
- tmpStr1 = Page_RS("NewsTitle")
- TmpStr = "<a href="""&get_NewsLink(Page_RS("NewsID"))&""">"&tmpStr1&"</a>"
- end if
- end If
- End If
- Page_RS.close
- End If
- tmprs_.close
- case else
- response.Write("Error:"&stype&" is not found.")
- end select
- response.Write(TmpStr)
- ConnClose()
- '得到新闻单个地址____________________________________________________________
- Function get_NewsLink(f_id)
- get_NewsLink = ""
- dim rs,config_rs,config_mf_rs,class_rs,sys_tmprs_
- dim SaveNewsPath,FileName,FileExtName,ClassId,LinkType,MF_Domain,Url_Domain,ClassEName,c_Domain,c_SavePath,IsDomain
- set rs = Conn.execute("select ID,IsURL,URLAddress,ClassId,NewsId,SaveNewsPath,FileName,FileExtName From FS_NS_News where NewsId='"&f_id&"'")
- if rs.eof then rs.close:get_NewsLink="":exit Function
- SaveNewsPath = rs("SaveNewsPath")
- FileName = rs("FileName")
- FileExtName = rs("FileExtName")
- ClassId = rs("ClassId")
- set sys_tmprs_ = Conn.execute("select top 1 LinkType,IsDomain from FS_NS_SysParam")
- if not sys_tmprs_.eof then
- LinkType = sys_tmprs_(0) ' Request.Cookies("FoosunNSCookies")("FoosunNSLinkType")
- IsDomain = sys_tmprs_(1) ' Request.Cookies("FoosunNSCookies")("FoosunNSDomain")
- end if
- sys_tmprs_.close
- MF_Domain = Cookie_Domain
- set class_rs = Conn.execute("select ClassEName,IsURL,URLAddress,[Domain],SavePath From FS_NS_NewsClass where ClassId='"&ClassId&"'")
- if not class_rs.eof then
- ClassEName = class_rs("ClassEName")
- c_Domain = class_rs("Domain")
- c_SavePath = class_rs("SavePath")
- class_rs.close
- else
- ClassEName = ""
- class_rs.close
- end if
- if not rs.eof then
- if rs("IsURL")=0 then
- if LinkType = 1 then
- if trim(c_Domain)<>"" then
- Url_Domain = "http://"&c_Domain
- else
- if trim(IsDomain)<>"" then
- Url_Domain = "http://"&IsDomain
- else
- Url_Domain = "http://"&MF_Domain
- end if
- end if
- else
- if trim(c_Domain)<>"" then
- Url_Domain = "http://"&c_Domain
- else
- if trim(IsDomain)<>"" then
- Url_Domain = "http://"&IsDomain
- else
- Url_Domain = ""
- end if
- end if
- end if
- if trim(c_Domain)<>"" then
- get_NewsLink = Url_Domain & SaveNewsPath &"/"&FileName&"."&FileExtName
- else
- get_NewsLink = Url_Domain & c_SavePath& "/" & ClassEName &SaveNewsPath &"/"&FileName&"."&FileExtName
- end if
- else
- get_NewsLink = rs("URLAddress")
- end if
- rs.close
- else
- get_NewsLink = ""
- rs.close
- end if
- get_NewsLink = get_NewsLink
- End Function
- Sub ConnClose()
- Set Conn = Nothing
- response.End()
- End Sub
- %>