📄 search.asp
字号:
<!--#include file="conn.asp" -->
<!--#include file="inc/const.asp"-->
<%
Dim j
Dim i
Dim keyword
Dim findword
Dim Action
Dim CurrentPage
Dim maxperpage
Dim totalnumber
Dim Pcount
Dim Rs
Dim SQL
Dim HtmlString
Dim SoftName
Dim Soft_Name
Dim SoftSize
Dim SoftTime
Dim Content
Dim Title
Dim Stitle
Dim InfoTime
Dim NewCloud_Ads
Dim temphtml
Dim NowStats
Dim HtmlTitle
Dim TempTopStr
Dim TempFootStr
Dim bookmark
Set Rs = Server.CreateObject("adodb.recordset")
Action = UCase(Trim(Request("Action")))
keyword = Trim(Request("keyword"))
If Not IsEmpty(Request("page")) Then
CurrentPage = CInt(Request("page"))
Else
CurrentPage = 1
End If
If Not IsNumeric(Request("page")) And Request("page") <> "" Then
Response.Write "错误的系统参数!请输入整数"
Err.Raise -19691969
End If
Newasp.LoadTemplates ("search")
Set NewCloud_Ads = New Adcolumn_Cls
NowStats = "搜索引擎"
HtmlTitle = "搜索引擎"
maxperpage = CInt(Newasp.TempSet(1)) '###每页显示数
temphtml = Newasp.mainhtml(0) & Newasp.mainhtml(1) & Newasp.mainhtml(2) & Newasp.mainhtml(3) & Newasp.temphtml(0)
temphtml = Replace(temphtml, "{$NavMenu}", Newasp.SortingMenu)
If CInt(Newasp.Setting(5)) = 0 Then
temphtml = Replace(temphtml, "{$TopMeun}", Newasp.mainset(9))
Else
temphtml = Replace(temphtml, "{$TopMeun}", Newasp.mainset(10))
End If
temphtml = Replace(temphtml, "{$Style_CSS}", Newasp.Style_CSS)
temphtml = Replace(temphtml, "{$NowStats}", NowStats)
temphtml = Replace(temphtml, "{$Title}", HtmlTitle)
temphtml = Replace(temphtml, "{$KeyWord}", keyword)
If keyword = "" Then
Response.Write ("<script>alert('" & Newasp.TempSet(3) & "');history.go(-1)</script>")
Err.Raise -19691969
Else
keyword = Replace(Replace(Replace(keyword, "'", "‘"), "<", "<"), ">", ">")
If Trim(Request("action")) = "soft" Then
findword = "SoftName like '%" & keyword & "%' or SoftVer like '%" & keyword & "%'"
SQL = "select Top " & CInt(Newasp.TempSet(0)) & " * from NC_SoftInfo where " & findword & " "
SQL = SQL & " order by softTime desc,softid desc"
ElseIf Trim(Request("action")) = "info" Then
findword = "title like '%" & keyword & "%' or Content like '%" & keyword & "%'"
SQL = "select Top " & CInt(Newasp.TempSet(0)) & " * from NC_Article where " & findword & " "
SQL = SQL & " order by InfoTime desc,id desc"
Else
Response.Redirect ("http://www1.baidu.com/baidu?word=" & keyword & "")
End If
End If
Rs.Open SQL, conn, 1, 1
If Rs.EOF And Rs.bof Then
temphtml = temphtml & Replace(Newasp.TempSet(4), "{$KeyWord}", keyword)
Else
totalnumber = Rs.recordcount
If (totalnumber Mod maxperpage) = 0 Then
Pcount = totalnumber \ maxperpage
Else
Pcount = totalnumber \ maxperpage + 1
End If
Rs.MoveFiRst
If CurrentPage > Pcount Then CurrentPage = Pcount
If CurrentPage < 1 Then CurrentPage = 1
Rs.Move (CurrentPage - 1) * maxperpage
bookmark = Rs.bookmark
i = 0
j = (CurrentPage - 1) * maxperpage + 1
If Action = "SOFT" Then
temphtml = temphtml & Newasp.temphtml(1)
End If
If Action = "INFO" Then
temphtml = temphtml & Newasp.temphtml(3)
End If
Do While Not Rs.EOF And i < CLng(maxperpage)
If Action = "SOFT" Then
temphtml = temphtml & Newasp.temphtml(2)
Soft_Name = Replace(Rs("SoftName"), "" & keyword & "", "<font color=red>" & keyword & "</font>") & Rs("SoftVer")
If CInt(Newasp.Setting(5)) = 0 Then
SoftName = "<a href='Software/catalog" & Rs("sortid") & "/" & Rs("SoftID") & ".html'>" & Soft_Name & "</a>"
Else
SoftName = "<a href='Software.Asp?id=" & Rs("SoftID") & "'>" & Soft_Name & "</a>"
End If
If Rs("SoftSize") > 1024 Then
SoftSize = (Round(Rs("SoftSize") / 1024, 2) & " MB")
Else
SoftSize = (Rs("SoftSize") & " KB")
End If
Content = Newasp.gotTopic(Replace(Trim(Rs("Content")), "" & keyword & "", "<font color=red>" & keyword & "</font>"), CInt(Newasp.TempSet(2)))
SoftTime = FormatDateTime(Rs("SoftTime"), 2)
temphtml = Replace(temphtml, "{$Sequence}", j)
temphtml = Replace(temphtml, "{$SoftName}", SoftName)
temphtml = Replace(temphtml, "{$SoftTime}", SoftTime)
temphtml = Replace(temphtml, "{$SoftSize}", SoftSize)
temphtml = Replace(temphtml, "{$Content}", Content)
temphtml = Replace(temphtml, "{$DateTime}", Rs("SoftTime"))
temphtml = Replace(temphtml, "{$Hits}", Rs("Hits"))
End If
If Action = "INFO" Then
temphtml = temphtml & Newasp.temphtml(4)
If CInt(Newasp.Setting(5)) = 0 Then
Stitle = Replace(Rs("title"), "" & keyword & "", "<font color=red>" & keyword & "</font>")
Title = "<a href='Article/catalog" & Rs("Classid") & "/" & Rs("ID") & ".html'>" & Stitle & "</a>"
Else
Title = "<a href='Article.Asp?id=" & Rs("ID") & "'>" & Stitle & "</a>"
End If
Content = Server.HtmlEncode(Trim(Rs("Content")))
Content = Newasp.gotTopic(Replace(Content, "" & keyword & "", "<font color=red>" & keyword & "</font>"), CInt(Newasp.TempSet(2)))
SoftTime = FormatDateTime(Rs("SoftTime"), 2)
temphtml = Replace(temphtml, "{$Sequence}", j)
temphtml = Replace(temphtml, "{$Title}", Title)
temphtml = Replace(temphtml, "{$InfoTime}", InfoTime)
temphtml = Replace(temphtml, "{$Content}", Content)
temphtml = Replace(temphtml, "{$DateTime}", Rs("InfoTime"))
temphtml = Replace(temphtml, "{$Hits}", Rs("Hits"))
End If
Rs.movenext
j = j + 1
i = i + 1
If i >= maxperpage Then Exit Do
Loop
End If
Rs.Close
Set Rs = Nothing
temphtml = temphtml & Newasp.temphtml(5)
temphtml = temphtml & Newasp.mainhtml(4)
temphtml = Replace(temphtml, "{$ShowPage}", ShowPage(maxperpage, totalnumber, CurrentPage))
temphtml = Replace(temphtml, "{$Width}", Newasp.mainset(0))
temphtml = Replace(temphtml, "{$FootMeun}", Newasp.mainset(11))
temphtml = Replace(temphtml, "{$Adcolumn(0)}", NewCloud_Ads.RunScriptAds(7))
temphtml = Replace(temphtml, "{$Adcolumn(1)}", NewCloud_Ads.BannerAds(7))
temphtml = Replace(temphtml, "{$Adcolumn(2)}", NewCloud_Ads.AdsColumn(7, 2))
temphtml = Replace(temphtml, "{$Adcolumn(4)}", NewCloud_Ads.ScriptFloatAds(7))
temphtml = Replace(temphtml, "{$Adcolumn(5)}", NewCloud_Ads.ScriptFixedAds(7))
Response.Write temphtml
Private Function ShowPage(maxperpage, totalnumber, CurrentPage)
Dim ii
Dim n
Dim HtmlShowPage
If totalnumber Mod maxperpage = 0 Then
n = totalnumber \ maxperpage
Else
n = totalnumber \ maxperpage + 1
End If
HtmlShowPage = "<table cellspacing=1 width='100%' border=0><form method=Post action=?action=" & Request("action") & "&keyword=" & keyword & "><tr><td align=center> " & vbCrLf
If CurrentPage < 2 Then
HtmlShowPage = HtmlShowPage & " 查询到 <font COLOR=#FF0000>" & totalnumber & "</font> 条记录 首 页 上一页 "
Else
HtmlShowPage = HtmlShowPage & "查询到 <font COLOR=#FF0000>" & totalnumber & "</font> 条记录 <a href=?page=1&action=" & Request("action") & "&keyword=" & keyword & ">首 页</a> "
HtmlShowPage = HtmlShowPage & "<a href=?page=" & CurrentPage - 1 & "&action=" & Request("action") & "&keyword=" & keyword & ">上一页</a> "
End If
If n - CurrentPage < 1 Then
HtmlShowPage = HtmlShowPage & "下一页 尾 页 " & vbCrLf
Else
HtmlShowPage = HtmlShowPage & "<a href=?page=" & (CurrentPage + 1) & "&action=" & Request("action") & "&keyword=" & keyword & ">下一页</a>"
HtmlShowPage = HtmlShowPage & " <a href=?page=" & n & "&action=" & Request("action") & "&keyword=" & keyword & ">尾 页</a>" & vbCrLf
End If
HtmlShowPage = HtmlShowPage & " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
HtmlShowPage = HtmlShowPage & " <b>" & maxperpage & "</b>个/页 " & vbCrLf
HtmlShowPage = HtmlShowPage & " 转到: "
HtmlShowPage = HtmlShowPage & " <select name='page' size='1' style=""font-size: 9pt"" onChange='javascript:submit()'>" & vbCrLf
For ii = 1 To n
HtmlShowPage = HtmlShowPage & " <option value='" & ii & "' "
If CurrentPage = CInt(ii) Then
HtmlShowPage = HtmlShowPage & "selected "
End If
HtmlShowPage = HtmlShowPage & ">第" & ii & "页</option>"
Next
HtmlShowPage = HtmlShowPage & " </select> " & vbCrLf
HtmlShowPage = HtmlShowPage & "</td></tr></FORM></table>" & vbCrLf
ShowPage = HtmlShowPage
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -