search.asp
来自「1.支持文章」· ASP 代码 · 共 488 行 · 第 1/2 页
ASP
488 行
<%Option Explicit%>
<!--#include File="Conn.asp"-->
<!--#include file="SysCls/KS_CommonCls.asp"-->
<!--#include file="SysCls/KS_RefreshCls.asp"-->
<%
'===================================================================================================================
'软件名称:科汛网站管理系统
'当前版本:科汛网站管理系统 V2.2 0628 Free
'Copyright (C) 2006-2008 Kesion.Com All rights reserved.
'产品咨询QQ:9537636,41904294
'技术支持QQ:111394,54004407
'程序版权:科汛网络
'程序开发:科汛网络开发组(总策划:林文仲)
'E-Mail :kesioncms@hotmail.com webmaster@kesion.com
'官方网站:http://www.kesion.com
'演示站点:http://test.kesion.com
'郑重声明:
' ①、免费版本请在程序首页保留版权信息,并做上本站LOGO友情连接,商业版本无此要求;
' ②、任何个人或组织不得在授权允许的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息;
' ③、科汛网络保留此软件的法律追究权利
'===================================================================================================================
Dim SearchClass
Set SearchClass = New SearchResult
SearchClass.Execute()
Set SearchClass = Nothing
Class SearchResult
Private KSCMS,KMR
Private ChannelID,ClassID,SearchType,KeyWord,SearchForm
Private I,TotalPut, CurrentPage,MaxPerPage,RS
Private Sub Class_Initialize()
Set KSCMS=New CommonCls
Set KMR=New Refresh
MaxPerPage=10
If KSCMS.G("page") <> "" Then
CurrentPage = CInt(Request("page"))
Else
CurrentPage = 1
End If
ChannelID=KSCMS.G("ChannelID")
If ChannelID="" Or Not IsNumeric(ChannelID) Then ChannelID=0
ClassID=KSCMS.G("ClassID")
If ClassID="" Then ClassID="0"
SearchType=KSCMS.G("SearchType")
if SearchType="" Or Not IsNumeric(SearchType) Then SearchType=0
KeyWord=KSCMS.G("KeyWord")
End Sub
Private Sub Class_Terminate()
If IsObject(Conn) Then
Conn.Close
Set Conn = Nothing
End If
Set KSCMS=Nothing
Set KMR=Nothing
End Sub
Sub Execute()
Response.Write "<html>" & vbcrlf
Response.Write "<head>" & vbcrlf
Response.Write "<title>搜索结果</title>" & vbcrlf
Response.Write "<link href=""" & KSCMS.GetConfig("InstallDir") & "Skin/style.css"" type=text/css rel=stylesheet>" & vbcrlf
Response.Write "</head>" & vbcrlf
Response.Write "<body leftmargin=0 topmargin=0>" & vbcrlf
Response.Write "<table width=""770"" border=""0"" align=""center"" cellspacing=""0"" cellpadding=""0"" class=""Search_table_border"">" & vbcrlf
Response.Write "<tr>" & vbcrlf
IF KeyWord="" Then
Response.Write "<td align=""center"" height=""25"" class=""Search_table_title""><strong>搜索结果...</font></td>" & vbcrlf
Else
Response.Write "<td align=""center"" height=""25"" class=""Search_table_title""><strong>关键字:<font color=red>" & KeyWord & "</font>,以下是搜索结果...</font></td>" & vbcrlf
End if
Response.Write "</tr>"& vbcrlf
Response.Write "<tr><td bgcolor=#ffffff height=520 valign=""_top"">" & vbcrlf
'分频道模块处理
Select Case ChannelID
Case 1
Call ArticleSearchResult()
SearchForm=KMR.GetArticleSearch()
Case 2
Call PhotoSearchResult()
SearchForm=KMR.GetPhotoSearch()
Case 3
Call DownSearchResult()
SearchForm=KMR.GetDownLoadSearch()
Case 4
Call FlashSearchResult()
SearchForm=KMR.GetFlashSearch()
Case else
Call AllSearchResult()
SearchForm=KMR.GetSearch()
End Select
Response.Write "</td></tr>" & vbcrlf
Response.Write "<tr><td height=25 bgcolor=#ffffff>" & vbcrlf
Response.Write SearchForm
Response.Write "</td></tr>" & vbcrlf
Response.Write "</table>" & vbcrlf
Response.Write "</body>" & vbcrlf
Response.Write "</html>" &vbcrlf
End Sub
Sub ArticleSearchResult() '文章搜索处理
Dim SqlStr
SqlStr="Select ID,Tid,Title,SubTitle,AddDate,Author,ArticleContent,Fname,InfoPurview,ReadPoint From KS_Article Where Verific=1 And DelTF=0 "
Select Case SearchType
Case 1
SqlStr=SqlStr & " And (Title Like '%" & KeyWord & "%' Or SubTitle Like '%" & KeyWord & "%')"
Case 2
SqlStr=SqlStr & " And ArticleContent Like '%" & KeyWord & "%'"
Case 3
SqlStr=SqlStr & " And Author Like '%" & KeyWord & "%'"
Case 4
SqlStr=SqlStr & " And ArticleInput Like '%" & KeyWord & "%'"
Case 5
SqlStr=SqlStr & " And KeyWords Like '%" & KeyWord & "%'"
Case else
SqlStr=SqlStr & " And (Title Like '%" & KeyWord & "%' Or SubTitle Like '%" & KeyWord & "%' or Author Like '%" & KeyWord & "%')"
End Select
If ClassID<>"0" Then
SqlStr=SqlStr & " And Tid='" & ClassID & "'"
End IF
SqlStr=SqlStr & " Order By AddDate Desc"
Response.Write "<table width=""98%"" border=""0"" align=""center"" cellspacing=""1"" cellpadding=""1"">" & vbcrlf
Set RS=Server.CreateObject("ADODB.RECORDSET")
RS.Open SqlStr,Conn,1,1
IF RS.Eof And RS.Bof Then
Response.Write "<tr><td>没有或没有找到任何信息</td></tr>"
Else
TotalPut = RS.RecordCount
If CurrentPage < 1 Then
CurrentPage = 1
End If
If (CurrentPage - 1) * MaxPerPage > totalPut Then
If (TotalPut Mod MaxPerPage) = 0 Then
CurrentPage = totalPut \ MaxPerPage
Else
CurrentPage = totalPut \ MaxPerPage + 1
End If
End If
If CurrentPage = 1 Then
Call ShowArticleContent()
Else
If (CurrentPage - 1) * MaxPerPage < totalPut Then
RS.Move (CurrentPage - 1) * MaxPerPage
Call ShowArticleContent()
Else
CurrentPage = 1
Call ShowArticleContent()
End If
End If
End IF
RS.Close
Set RS=Nothing
End Sub
Sub ShowArticleContent() '显示文章搜索结果
Dim N,FolderNameAndLinkStr,TempTitle
N=(CurrentPage-1)*MaxPerPage
Do While Not RS.Eof
N=N+1
FolderNameAndLinkStr = "[" & KSCMS.GetFolderNameAndLink(RS("Tid"), "target=""_blank""", "") & "]"
TempTitle = "<a href=""" & KSCMS.GetInfoUrl(1,RS) & """ target=""_blank"">" & Replace(RS("Title"),KeyWord,"<font color=red>" & KeyWord &"</font>") & "</a>"
Response.Write "<tr><td height=""20""><strong>" & N & "</strong>." & FolderNameAndLinkStr & "<strong>" & TempTitle & "</strong> [" & RS("Author") & "][" & RS("Adddate") & "]</TD></tr>" & vbcrlf
Response.Write "<tr><td height=""50""> " & Replace(KSCMS.GotTopic(Replace(Replace(Replace(KSCMS.LoseHtml(RS("ArticleContent")), vbCrLf, ""), "[NextPage]", ""), " ", ""),200),KeyWord,"<font color=red>" & KeyWord & "</font>") & "……</td></tr>" & vbcrlf
I = I + 1
If I >= MaxPerPage Then Exit Do
RS.MoveNext
Loop
Response.Write "<tr><td height='26' colspan='6' align='right'>"
Call KSCMS.ShowPageParamter(totalPut, MaxPerPage, "Search.asp", True, "篇", CurrentPage, "SearchType=" & SearchType & "&ClassID=" & ClassID & "&KeyWord=" & KeyWord & "&ChannelID=" & ChannelID )
Response.Write "</td></tr>" & vbcrlf
Response.Write" </table>" & vbcrlf
End Sub
Sub PhotoSearchResult() '图片搜索处理
Dim SqlStr
SqlStr="Select ID,Tid,Title,AddDate,Author,PictureContent,Fname,InfoPurview,ReadPoint From KS_Photo Where Verific=1 And DelTF=0 "
Select Case SearchType
Case 1
SqlStr=SqlStr & " And Title Like '%" & KeyWord & "%'"
Case 2
SqlStr=SqlStr & " And PictureContent Like '%" & KeyWord & "%'"
Case 3
SqlStr=SqlStr & " And Author Like '%" & KeyWord & "%'"
Case 4
SqlStr=SqlStr & " And PictureInput Like '%" & KeyWord & "%'"
Case 5
SqlStr=SqlStr & " And KeyWords Like '%" & KeyWord & "%'"
Case else
SqlStr=SqlStr & " And (Title Like '%" & KeyWord & "%' Or Author Like '%" & KeyWord & "%')"
End Select
If ClassID<>"0" Then
SqlStr=SqlStr & " And Tid='" & ClassID & "'"
End IF
SqlStr=SqlStr & " Order By AddDate Desc"
Response.Write "<table width=""98%"" border=""0"" align=""center"" cellspacing=""1"" cellpadding=""1"">" & vbcrlf
Set RS=Server.CreateObject("ADODB.RECORDSET")
RS.Open SqlStr,Conn,1,1
IF RS.Eof And RS.Bof Then
Response.Write "<tr><td>没有或没有找到任何信息</td></tr>"
Else
TotalPut = RS.RecordCount
If CurrentPage < 1 Then
CurrentPage = 1
End If
If (CurrentPage - 1) * MaxPerPage > totalPut Then
If (TotalPut Mod MaxPerPage) = 0 Then
CurrentPage = totalPut \ MaxPerPage
Else
CurrentPage = totalPut \ MaxPerPage + 1
End If
End If
If CurrentPage = 1 Then
Call ShowPhotoContent()
Else
If (CurrentPage - 1) * MaxPerPage < totalPut Then
RS.Move (CurrentPage - 1) * MaxPerPage
Call ShowPhotoContent()
Else
CurrentPage = 1
Call ShowPhotoContent()
End If
End If
End IF
RS.Close
Set RS=Nothing
End Sub
Sub ShowPhotoContent() '显示图片搜索结果
Dim N,FolderNameAndLinkStr,TempTitle
N=(CurrentPage-1)*MaxPerPage
Do While Not RS.Eof
N=N+1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?