<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--#
include file="conn.asp"-->
<% if trim(request("keywords"))="" then response.write("非法参数!") else%>
<% if trim(request("keywords"))<>"" then %>
<%
Function ReqStr(keywords)
keywords=request(keywords)
keywords=replace(keywords,"'","")
keywords=replace(keywords,"%20","")
keywords=replace(keywords,"and","")
keywords=replace(keywords,"or","")
keywords=replace(keywords," ","")
keywords=replace(keywords,"select","")
keywords=replace(keywords,"update","")
keywords=replace(keywords,"delete","")
keywords=keywords
End Function
response.write"keywords"
%>
<%
'**************
'
分页导航栏函数
'输出wzpage值
'**************
Function pagination(pagecount)
Dim wzpage,wzpagecount,pagenum,boardid
boardid = Request.QueryString("board_id")
If boardid = 0 Then boardid = 1
If Len(Request.QueryString("page"))<>0 Then
wzpage = clng(Request.QueryString("page"))
Else
wzpage =1
End If
If wzpage <= 0 Then wzpage =1
pagenum = (wzpage 10)*10+1
If wzpage mod 10 = 0 Then pagenum = (wzpage 10)*10-9
If wzpage > 10 Then
Response.Write ("<font face=""webdings"">")
Response.Write ("<a href=""?board_id="& boardid &"&keywords="& trim(request("keywords")) &"&page=1&cord="&request("cord")&""" title=""首页"">9</a>")
Response.Write ("<a href=""?board_id="& boardid &"&page="& pagenum-1 &"&keywords="& trim(request("keywords")) &"&cord="&request("cord")&""" title=""前十页"">7</a>")
Response.Write ("</font>")
End If
For pagenum = pagenum To pagenum + 9
If pagenum = wzpage Then
Response.Write ("<font color=""#ff0000"">")
Response.Write (" ["& pagenum &"] ")
Response.Write ("</font>")
Else
Response.Write (" <a href=""?board_id="& boardid &"&page="& pagenum &"&keywords="& trim(request("keywords")) &"&cord="& request("cord") &""">")
Response.Write ("["& pagenum &"]")
Response.Write ("</a> ")
End If
If pagenum >= pagecount Then Exit For
Next
If wzpage < (pagecount - (pagecount 10)) Then
Response.Write ("<font face=""webdings"">")
Response.Write ("<a href=""?board_id="& boardid &"&page="& pagenum &"&keywords="& trim(request("keywords")) &"&cord="&request("cord")&""" title=""后十页"">8</a>")
Response.Write ("<a href=""?board_id="& boardid &"&page="& pagecount &"&keywords="& trim(request("keywords")) &"&cord="&request("cord")&""" title=""末页"">:</a>")
Response.Write ("</font>")
End If
End Function
%>
<%
dim getstring, sq
getstring = clng(request.querystring("board_id"))
if getstring = 0 then getstring = 1
'******************************************
'取文章总数及每页重复显示条数,准备分页
'wzcount 文章总数
'wzrep 重复显示条数
'wzpage 分页参数id
'wzpagecount 总页数
'******************************************
dim wzcount,wzrep,wzpage,wzpagecount,wzpagerep,boardstr
wzrep = 2
'rssql = "select count(id) from `table1`"
'rs.open rssql,conn,0,1,&h0001
if request("cord")=1 then
sq="select count(id) from lyb where name like '%"&request("keywords")&"%'"
elseif request("cord")=2 then sq="select count(id) from lyb where ln like '%"&request("keywords")&"%'"
end if
wzcount = conn.execute (sq,0,1)(0)
'rs.close
wzpagecount = abs(int(-abs(wzcount/wzrep)))
wzpage = clng(request.querystring("page"))
if len(wzpage) = 0 or wzpage = 0 then wzpage = 1
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>search_www.jb200.com</title>
</head>
<body>
<% dim sql
set rs=server.CreateObject("adodb.recordset")
'取文章列表
if request("cord")=1 then
sql="select * from lyb where name like '%"&trim(request("keywords"))&"%' order by time desc"
elseif request("cord")=2 then sql="select * from lyb where ln like '%"&trim(request("keywords"))&"%' order by time desc"
end if
rs.open sql,conn,1,1,&h0001
'显示文章标题列表
if rs.eof and rs.bof then%>
<table><tr>
<td >没有找到相关的信息!</td>
</tr></table>
<% else
rs.absoluteposition=rs.absoluteposition+((abs(wzpage)-1)*wzrep)
'根据分页参数获取
当前页面纪录
dim i
for i = 0 to wzrep-1
if rs.eof then exit for
%>
<% if not rs.eof then%>
<table width="200" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr>
<td height="30" bgcolor="#FF0000"><%=rs("name")%></td>
</tr>
<tr>
<td height="15" bgcolor="#FFFFFF"> </td>
</tr>
</table>
<%
rs.movenext
end if
next
end if
%>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="50">共<font color=red><%= wzcount%></font>条 <font color=red><%= wzrep%></font>/页 共<font color=red><%= wzpagecount%></font>页
<%= pagination(wzpagecount)%></td>
</tr>
</table>
</body>
</html>
<%end if%>