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

数据库编程

开发平台:

ASP/ASPX

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
  2. <% Option Explicit %>
  3. <%session.CodePage="936"%>
  4. <!--#include file="FS_Inc/Const.asp" -->
  5. <!--#include file="FS_InterFace/MF_Function.asp" -->
  6. <!--#include file="FS_Inc/Function.asp" -->
  7. <!--#include file="FS_Inc/Func_Page.asp" -->
  8. <%'Copyright (c) 2006 Foosun Inc. Code by awen
  9. Server.ScriptTimeOut=999
  10. Response.Buffer = True
  11. Response.Expires = -1
  12. Response.ExpiresAbsolute = Now() - 1
  13. Response.CacheControl = "no-cache"
  14. response.Charset = "gb2312"
  15. Dim starttime,endtime
  16. starttime=timer()
  17. function morestr(str,length)
  18. if len(str)>length then 
  19. morestr = left(str,length)&"<strong>...</strong>"
  20. else
  21. morestr = str
  22. end if   
  23. end function
  24. Dim Conn,User_Conn,Search_Sql,Search_RS,strShowErr,Cookie_Domain,Cookie_Copyright,Cookie_eMail,Cookie_Site_Name
  25. Dim Server_Name,Server_V1,Server_V2
  26. Dim TmpStr,TmpArr,SqlDateType,FileSize,FileEditDate,TmpStr1
  27. Dim Tags,s_type,SubSys,ClassId,s_date,e_date  ,GetType
  28. Dim ChildDomain,ClassPath
  29. GetType = NoSqlHack(request.QueryString("GetType")) ''内部
  30. if GetType = "" then response.Write("请指定必要的参数.") : response.End()
  31. ''日期
  32. If G_IS_SQL_DB = 1 Then  
  33. SqlDateType = "'"
  34. else
  35. SqlDateType = "#"
  36. end if
  37. Function Get_MF_Config()
  38. if request.Cookies("FoosunSearchCookie")("Cookie_Domain") = Get_MF_Domain() then exit Function
  39. set Search_RS=Conn.execute("select top 1 MF_Domain,MF_Site_Name,MF_eMail,MF_Copyright_Info  from FS_MF_Config")
  40. Response.Cookies("FoosunSearchCookie")("Cookie_Domain")=Search_RS("MF_Domain") 
  41. Response.Cookies("FoosunSearchCookie")("Cookie_Copyright")=Search_RS("MF_Copyright_Info") 
  42. Response.Cookies("FoosunSearchCookie")("Cookie_eMail")=Search_RS("MF_eMail") 
  43. Response.Cookies("FoosunSearchCookie")("Cookie_Site_Name")=Search_RS("MF_Site_Name") 
  44. Response.Cookies("FoosunSearchCookie").Expires=Date()+1
  45. Search_RS.close
  46. End Function
  47. ''++++++++++++++++++++++++++++++++++++
  48. '检查本地文件 返回大小和修改日期
  49. Function CheckFile(PhFileName)
  50. On Error Resume Next
  51. FileEditDate="":FileSize=""
  52. if isnull(PhFileName) or PhFileName="" then CheckFile="|":exit Function
  53. Dim Fso,MyFile
  54. Set Fso = CreateObject(G_FS_FSO)
  55. If Fso.FileExists(server.MapPath(PhFileName)) Then
  56. set MyFile = Fso.GetFile(server.MapPath(PhFileName))
  57. FileEditDate = MyFile.DateLastModified
  58. FileSize = formatnumber(MyFile.Size/1024,1,-2)&"K"
  59. set MyFile = nothing 
  60. End if
  61. if Err<>0 then Err.clear : CheckFile="|":exit Function
  62. Set Fso = Nothing
  63. CheckFile = FileSize&"|"&FileEditDate
  64. End Function
  65. MF_Default_Conn
  66. MF_User_Conn
  67. Get_MF_Config
  68. Cookie_Domain = request.Cookies("FoosunSearchCookie")("Cookie_Domain")
  69. Cookie_Copyright = request.Cookies("FoosunSearchCookie")("Cookie_Copyright")
  70. Cookie_eMail = request.Cookies("FoosunSearchCookie")("Cookie_eMail")
  71. Cookie_Site_Name = request.Cookies("FoosunSearchCookie")("Cookie_Site_Name")
  72. if Cookie_Domain="" then 
  73. Cookie_Domain = "http://localhost"
  74. else
  75. if left(lcase(Cookie_Domain),len("http://"))<>"http://" then Cookie_Domain = "http://"&Cookie_Domain
  76. if right(Cookie_Domain,1)="/" then Cookie_Domain = mid(Cookie_Domain,1,len(Cookie_Domain) - 1)
  77. end if
  78. ''防盗连
  79. Server_Name = Len(Request.ServerVariables("SERVER_NAME"))
  80. Server_V1 = Left(Replace(Cstr(Request.ServerVariables("HTTP_REFERER")),"http://",""),Server_Name)
  81. Server_V2 = Left(Cstr(Request.ServerVariables("SERVER_NAME")),Server_Name)
  82. if Server_V1 <> Server_V2 and Server_V1 <> "" and Server_V2 <> "" then
  83. response.Write("没有权限,请访问<a href="""&Cookie_Domain&""">"&Cookie_Domain&"</a>.")
  84. response.End()
  85. end if
  86. ''+++++++++++++++++++++++++++++++++++++++++++
  87. select case GetType
  88. case "LoginHtml"
  89. %>
  90. <FONT size=-1><A href="<%=Cookie_Domain&"/User/Login.asp"%>" target="_blank">登录</A></FONT>
  91. <%case "FootHTML"%>
  92. &nbsp;<BR>
  93.         <BR>
  94.         <FONT 
  95.       size=-1><%=Cookie_Copyright%></FONT><BR><BR>
  96.   
  97. <%case "CopyrightHTML"
  98. TmpStr = "<TABLE cellSpacing=0 cellPadding=2 width=""100%"" border=0>"&vbNewLine _ 
  99. &"<TR>"&vbNewLine _ 
  100. &"<TD align=right height=25><font size=-1>"&vbNewLine _
  101. &"<a class=fl href=""javascript:window.external.AddFavorite('"&Cookie_Domain&"', '"&Cookie_Site_Name&"')"">加入收藏</a>"&vbNewLine _
  102. &" - <a class=fl href=""#"" onClick=""this.style.behavior='url(#default#homepage)';this.setHomePage('"&Cookie_Domain&"')"">设为主页</a>"&vbNewLine _
  103. &" - <A class=fl href=""#"">Top</A>"&vbNewLine _
  104. &"</font></TD>"&vbNewLine _
  105. &"</TR>"&vbNewLine _
  106. &"</TABLE>"&vbNewLine _ 
  107. &"</CENTER>"&vbNewLine
  108. response.Write(TmpStr)  
  109. case "MainInfo"
  110. Tags = NoHtmlHackInput(NoSqlHack(request.QueryString("Tags")))
  111. if Tags = "" then strShowErr=strShowErr&"<li>关键字不能为空</li>"&vbnewLine
  112. Tags = replace(Tags,",",",")
  113. if strShowErr<>"" then strShowErr=strShowErr&"<li><a href="""&Cookie_Domain&""">"&Cookie_Domain&"</a>.</li>": response.Write(strShowErr):response.End()
  114. Search_Sql = "select iLogID,iLogStyle,Title,UserName,HeadPic,Sex,Corner,Province,City,ClassName,KeyWords,Content,iLogSource,MainID,ClassID,isTF,A.Hits,EmotFace,isTop," _
  115. &"TempletID,savePath,FileName,FileExtName,Pic_1,Pic_2,Pic_3,Password,AddTime " _ 
  116. &" from FS_ME_Infoilog A,FS_ME_iLogClass B,FS_ME_Users C where A.ClassID=B.id and " _
  117. &" A.UserNumber=C.UserNumber and A.isLock=0 and A.isDraft=0 and A.adminLock=0 "
  118. TmpArr = split(Tags,",")
  119. TmpStr1 = ""
  120. for each TmpStr in TmpArr
  121. if trim(TmpStr)<>"" then 
  122. if ubound(TmpArr)>0 then 
  123. TmpStr1 = TmpStr1 & " or A.KeyWords like '%"&Trim(TmpStr)&"%' "
  124. else
  125. TmpStr1 =  " A.KeyWords like '%"&Trim(TmpStr)&"%' "
  126. end if 
  127. end if
  128. next
  129. if ubound(TmpArr)>0 then TmpStr1 = " ("& mid(TmpStr1,len(" or ")) &") " 
  130. Search_Sql = and_where(Search_Sql) & TmpStr1
  131. On Error Resume Next
  132. '''response.Write(Search_Sql) '测试用
  133. Set Search_RS = CreateObject(G_FS_RS)
  134. Search_RS.Open Search_Sql,User_Conn,1,1
  135. if Err<>0 then 
  136. Err.Clear
  137. response.Write("<li>查询条件不匹配.无法继续.</li>")
  138. response.End()
  139. end if
  140. Dim int_RPP,int_Start,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo
  141. int_RPP=10 '设置每页显示数目
  142. int_showNumberLink_=10 '数字导航显示数目
  143. showMorePageGo_Type_ = 1 '是下拉菜单还是输入值跳转,当多次调用时只能选1
  144. str_nonLinkColor_="#999999" '非热链接颜色
  145. toF_="<font face=webdings>9</font>"    '首页 
  146. toP10_=" <font face=webdings>7</font>" '上十 
  147. toP1_=" <font face=webdings>3</font>" '上一
  148. toN1_=" <font face=webdings>4</font>" '下一
  149. toN10_=" <font face=webdings>8</font>" '下十
  150. toL_="<font face=webdings>:</font>" '尾页
  151. IF Search_RS.eof THEN%>
  152. <TABLE class="t bt" cellSpacing=0 cellPadding=0 width="100%" border=0>
  153.   <TBODY>
  154.   <TR>
  155.     <TD noWrap><FONT size=+1>&nbsp;<B><FONT size=+1>&nbsp;<B><%=TmpStr%></B></FONT>&nbsp;</B></FONT>&nbsp;</TD>
  156.     <TD noWrap align=right>
  157. <FONT size=-1>共有<B>0</B>项符合<B><%=Tags%></B>的查询结果
  158. (搜索用时 <B><%=FormatNumber((timer()-starttime),1,-2)%></B>毫秒)&nbsp;</FONT>
  159. </TD>
  160.    </TR>
  161.   </TBODY>
  162. </TABLE>
  163. <p><font size=-1 color=#666666>未查询到符合条件的记录。</font></p>
  164. <%else
  165. Dim UrlAndTitle,SaveNewsPath,Content,NewsSmallPicFile,NewsPicFile,addtime,NaviContent ,SysRs_Tmp,ChildPath,picShuXing,picShuXingB,NoNewsSmallPicFile
  166. Dim EmotFace
  167. Search_RS.PageSize=int_RPP
  168. cPageNo=Request.QueryString("Page")
  169. If cPageNo="" or not isnumeric(cPageNo) Then cPageNo = 1
  170. cPageNo = Clng(cPageNo)
  171. If cPageNo<1 Then cPageNo=1
  172. If cPageNo>Search_RS.PageCount Then cPageNo=Search_RS.PageCount 
  173. Search_RS.AbsolutePage=cPageNo
  174.   FOR int_Start=1 TO int_RPP 
  175.   
  176.   ChildPath = Cookie_Domain
  177. set SysRs_Tmp = User_Conn.execute("select top 1 Dir from FS_ME_iLogSysParam")
  178. if not SysRs_Tmp.eof then ChildPath = ChildPath & "/"&SysRs_Tmp(0)&"/"
  179. SysRs_Tmp.close
  180. SaveNewsPath = ChildPath &"blog.asp?id="&Search_RS("iLogID")
  181. UrlAndTitle = "<A class=l href="""&SaveNewsPath&""" target=_blank>"&Search_RS("Title")&"</A>"
  182. addtime = Search_RS("AddTime")
  183. if isnull(addtime) then addtime=""
  184. if isdate(addtime) then addtime = FormatDateTime(addtime,0)
  185. NewsSmallPicFile = Search_RS("HeadPic")
  186. if Search_Rs("Sex")=0 then 
  187. NoNewsSmallPicFile = "sys_images/man.gif"
  188. else
  189. NoNewsSmallPicFile = "sys_images/wom.gif"
  190. end if
  191. if NewsSmallPicFile = "" then 
  192. NewsSmallPicFile = NoNewsSmallPicFile
  193. else
  194. NewsSmallPicFile = Cookie_Domain&NewsSmallPicFile
  195. end if
  196. NaviContent = Search_RS("Content")
  197. if isnull(NaviContent) or NaviContent="" then 
  198. NaviContent = "暂无"
  199. else
  200. NaviContent = morestr(Lose_Html(NaviContent),200)
  201. EmotFace = Search_RS("EmotFace")
  202. if instr(EmotFace,"sys_images/emot")=0 then EmotFace = "sys_images/emot/"&replace(EmotFace,"/","")
  203. EmotFace = Replacestr(Search_RS("EmotFace"),":,else:<img border=0 src="""&EmotFace&""" />&nbsp;")
  204. TmpArr = split(Tags,",")
  205. TmpStr1 = ""
  206. for each TmpStr in TmpArr
  207. if trim(TmpStr)<>"" then 
  208. TmpStr1 = TmpStr1 & replace(NaviContent,Trim(TmpStr),"<font color=red>"&Trim(TmpStr)&"</font>")
  209. end if
  210. next
  211. NaviContent = EmotFace & TmpStr1
  212. end if
  213. TmpStr = Replacestr(Search_RS("iLogStyle"),"0:日记,1:网摘")
  214. Content="<TABLE cellSpacing=1 cellPadding=1 border=0 width=""80%"">"&vbNewLine _
  215. &"<TBODY>"&vbNewLine _
  216.   &"<TR>"&vbNewLine _ 
  217. &"<TD style=""width:60px;height:60px"" rowspan=2 align=center>"&vbNewLine 
  218. picShuXing = CheckFile(NewsSmallPicFile)
  219. if picShuXing<>"|" then 
  220. Content=Content&"<img border=0 src="""&NewsSmallPicFile&""" alt=""图片属性:["&picShuXing&"]"" onload=""if(this.offsetWidth>60)this.width=60;""></TD>"&vbNewLine
  221. else
  222. Content=Content&"<img border=0 src="""&NoNewsSmallPicFile&""" onload=""if(this.offsetWidth>60)this.width=60;""></TD>"&vbNewLine
  223. end if
  224. picShuXing=""
  225. Content=Content &"<TD class=content valign=top>"&vbNewLine _
  226. &"<font size=-1>"&NaviContent&"</font>"&vbNewLine _
  227. &"</TD>"&vbNewLine _
  228.   &"</TR>"&vbNewLine _
  229.   &"<TR>"&vbNewLine _ 
  230. &"<TD height=21><font size=-1>"&vbNewLine _
  231. &"<font color=#008000>"&SaveNewsPath&" </font>" _
  232. &"<a class=fl href=""javascript:window.external.AddFavorite('"&SaveNewsPath&"', '"&Cookie_Site_Name&"')"">加入收藏</a>"&vbNewLine _
  233. &" - <a class=fl href=""#"" onClick=""this.style.behavior='url(#default#homepage)';this.setHomePage('"&SaveNewsPath&"')"">设为主页</a>"&vbNewLine _
  234. &"</font></TD>"&vbNewLine _
  235.   &"</TR>"&vbNewLine _
  236. &"</TBODY>"&vbNewLine _
  237.    &"</TABLE>"&vbNewLine
  238. if int_Start = 1 then%>      
  239. <TABLE class="t bt" cellSpacing=0 cellPadding=0 width="100%" border=0>
  240.   <TBODY>
  241.   <TR>
  242.     <TD noWrap><FONT size=+1>&nbsp;<B><FONT size=+1>&nbsp;<B><%=TmpStr%></B></FONT>&nbsp;</B></FONT>&nbsp;</TD>
  243.     <TD noWrap align=right>
  244. <FONT size=-1>共有<B><%=Search_RS.recordcount%></B>项符合 <B><%=morestr(Tags,30)%></B> 的查询结果,
  245. 以下是第 <B>1</B> - <B>10</B> 项。(搜索用时 <B><%=FormatNumber((timer()-starttime),1,-2)%></B> 秒)&nbsp;</FONT>
  246. </TD></TR></TBODY></TABLE>
  247. <%end if%>
  248. <DIV>
  249. <div>
  250.   <P class=g>
  251.   <%
  252.   ''标题
  253.   response.Write(UrlAndTitle)
  254.   response.Write("<font size=-2 color=#666666>")
  255.   response.Write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&addtime&vbNewLine)
  256.   response.Write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
  257.   response.Write(" | 分类:"&Replacestr(Search_Rs("ClassName"),":,else:"&Search_Rs("ClassName")))
  258.   if Search_Rs("iLogSource")<>"" then response.Write(" | <a href="""&Search_Rs("iLogSource")&""" title="""&Search_Rs("iLogSource")&""" target=_blank>来源</a>"&vbNewLine)
  259.   response.Write(" | 作者:"&Replacestr(Search_Rs("UserName"),":,else:"&Search_Rs("UserName")))
  260.   response.Write( Replacestr(Search_Rs("Sex"),"1:[女],0:[男]") )
  261.   response.Write(" | 来自:"&Replacestr(Search_Rs("Corner"),":,else:"&Search_Rs("Corner")))
  262.   response.Write(Replacestr(Search_Rs("Province"),":,else: "&Search_Rs("Province")))
  263.   response.Write(Replacestr(Search_Rs("City"),":,else: "&Search_Rs("City"))  &"]")
  264.   response.Write(Replacestr(Search_Rs("isTF"),"0:,1: | 推荐"))
  265.   response.Write(" | 人气:["&Replacestr(Search_Rs("Hits"),":,else:"&Search_Rs("Hits"))&"]")
  266.   response.Write("</font>")
  267.   response.Write(Content)
  268. %>
  269. </div>
  270. <%
  271. ''+++++++++++++++++++++++++++++++++++++++
  272. Search_RS.MoveNext
  273. if Search_RS.eof or Search_RS.bof then exit for
  274.   NEXT
  275. %>
  276. <BR clear=all>
  277. <DIV class=n id=navbar> 
  278.   <TABLE cellSpacing=0 cellPadding=0 width="1%" align=center border=0>
  279.     <TBODY>
  280.       <TR style="TEXT-ALIGN: center" vAlign=top align=middle> 
  281.         <TD vAlign=bottom noWrap class=i><FONT size=-1>结果页码:&nbsp;</FONT> 
  282.         <TD noWrap class="i"><font size=-1>&nbsp; 
  283. <%response.Write( fPageCount(Search_RS,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo)  & vbcrlf )%>
  284. </font></TR>
  285.     </TBODY>
  286.   </TABLE>
  287. </DIV> 
  288. <%
  289. END IF
  290. RsClose
  291. end select
  292. Sub RsClose()
  293. Search_RS.Close
  294. Set Search_RS = Nothing
  295. end Sub
  296. set User_Conn=nothing
  297. Set Conn = Nothing
  298. response.End()
  299. %>