⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 research.asp

📁 21世纪人才www.51zy.net 网站源码
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="webconfig.asp"-->
<%if IsNumeric(request.QueryString("jiage"))=False then
        response.write"<script>alert(""输入错误,如有疑问请联系管理员!"");location.href=""index.asp"";</script>"
        response.end
	end if
dim action,searchkey,anclassid,jiage,selectname
anclassid=request("anclassid")
searchkey=request("searchkey")
selectname=request("selectname")
jiage=request("jiage")
action=request("action")
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=webname%>-商品信息</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>

<body>
<!-- 导航菜单 -->
<!--#include file="top.asp" -->
<div id="content">
	<!-- 快捷导航 -->
	<div id="content_m"><a href="index.asp">首页</a> > <span class="new">搜索</span></div>
	<!-- 右侧内容 -->
	<div id="content_r">
		<!-- 高级搜索 -->
	  <div id="advancedsearch">
        <%if jiage="" then%>
            <%if searchkey="" then
		response.write "<script language=""javascript"" type=""text/javascript"">alert('对不起,请您输入查讯关键字');history.go(-1);</script></div></div></div></body></html>"
		response.End
	      else
		response.write " 您查讯的关键字是: "
		if anclassid<>0 then
			set rs=server.CreateObject("adodb.recordset")
			rs.open "select * from shop_anclass where anclassid="&anclassid,conn,1,1
			response.write "<a href=class.asp?lx=big&anid="&anclassid&"><font color=red>"&rs("anclass")&"</font></a>"&" &gt;&gt; "
			rs.close
			set rs=nothing
		end if
		response.write "<span class=""new"">"&searchkey&"</span>"
		s_bookname=searchkey
	      end if%>
        <%else%>
            <%if (action="1" or action="3") and searchkey="" then
		response.write "<script language=""javascript"" type=""text/javascript"">alert('对不起,请您输入查讯关键字');history.go(-1);</script>"
		response.End
	      else
	        response.write " 您查讯的关键字是: "
		if anclassid<>0 then
			set rs=server.CreateObject("adodb.recordset")
			rs.open "select * from shop_anclass where anclassid="&anclassid,conn,1,1
			response.write "<a href=class.asp?lx=big&anid="&anclassid&"><font color=red>"&rs("anclass")&"</font></a>"&" &gt;&gt; "
			rs.close
			set rs=nothing
		end if
		if action="1" or action="3" then 
			response.write "<span class=""new"">"&searchkey&"</span>"
			s_bookname=searchkey
		else
			response.write "<span class=""new"">"&selectname&"</span>"
			s_bookname=selectname
end if
end if%>
<%end if%>
<!-- 分页程序 -->
      <%'开始分页
				Const MaxPerPage=20
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages
   				dim j
   				dim sql
    				if Not isempty(request("page")) then
      				currentPage=Cint(request("page"))
   				else
      				currentPage=1
   				end if 

if jiage="" then  '//普通查询
sql2="searchkey="&searchkey&"&anclassid="&anclassid
select case request("anclassid")
case "0"
sql1=" bookname like '%"&searchkey&"%' "
case else
sql1=" bookname like '%"&searchkey&"%' and anclassid="&request("anclassid")&" "
end select
else
'//高级查讯
sql2="searchkey="&searchkey&"&anclassid="&anclassid&"&jiage="&jiage&"&action="&action&"&selectname="&selectname
if anclassid<>0 then  '//判断查讯分类,分类不为空。  
select case action
case "1"
sql1=" bookname like '%"&searchkey&"%' and (shichangjia<"&jiage&" or huiyuanjia<"&jiage&" or vipjia<"&jiage&") and anclassid="&anclassid&" "
case "2"
sql1=" pingpai like '%"&selectname&"%' and (shichangjia<"&jiage&" or huiyuanjia<"&jiage&" or vipjia<"&jiage&") and anclassid="&anclassid&" "
case "3"
sql1=" bookcontent like '%"&selectname&"%' and (shichangjia<"&jiage&" or huiyuanjia<"&jiage&" or vipjia<"&jiage&") and anclassid="&anclassid&" "
end select
else
'//分类为空。
select case action
case "1"
sql1=" bookname like '%"&searchkey&"%' and (shichangjia<"&jiage&" or huiyuanjia<"&jiage&" or vipjia<"&jiage&") "
case "2"
sql1=" pingpai like '%"&selectname&"%' and (shichangjia<"&jiage&" or huiyuanjia<"&jiage&" or vipjia<"&jiage&") "
case "3"
sql1=" bookcontent like '%"&selectname&"%' and (shichangjia<"&jiage&" or huiyuanjia<"&jiage&" or vipjia<"&jiage&") "
end select
end if
end if
call sss()
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_books where "&sql1&" order by adddate desc",conn,1,1	
  				if rs.eof And rs.bof then
       				Response.Write "<p align=center> 对不起,没有查讯到您需要的商品!</p><br>"
   				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
            			showContent
            			showpage totalput,MaxPerPage,"research.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"research.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"research.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0%>
		<table width="590" border="0" cellspacing="0" cellpadding="0">
          <tr class="tit">
            <td class="tit"><strong>商品略图</strong></td>
            <td class="tit"><strong>商品信息</strong></td>
            <td class="tit"><strong>商品价格</strong></td>
            <td class="tit"><strong>上架时间</strong></td>
            <td class="tit">&nbsp;</td>
          </tr>
      <%do while not rs.eof%>
          <tr>
            <td><%if rs("zhuang")="" then 
				response.write "<img src=images/emptybook.gif width=""70"" height=""70"" />"
				else%><a href="<%=trim(rs("zhuang"))%>" target="_blank"><img src="<%=trim(rs("bookpic"))%>" width="70" height="70" alt="点击浏览商品大图" /></a><%end if%></td>
            <td><a href=list.asp?id=<%=rs("bookid")%> title=<%=rs("bookname")%> target="_blank"><strong><%=rs("bookname")%></strong></a></td>
            <td>售价:<span class="new"><%=rs("huiyuanjia")%></span>元</td>
            <td><%=rs("adddate")%></td>
            <td><a href="gouwu.asp?id=<%=rs("bookid")%>&action=add" target="_blank">购买</a></td>
          </tr>
      <%i=i+1
		if i>=MaxPerPage then Exit Do
		rs.movenext
  loop
  rs.close
  set rs=nothing%>
        <%End Sub   
				Function showpage(totalnumber,maxperpage,filename)  
  				Dim n
				If totalnumber Mod maxperpage=0 Then  
					n= totalnumber \ maxperpage  
				Else
					n= totalnumber \ maxperpage+1  
				End If
				Response.Write "<div class=""page""><form method=Post action="&filename&"?searchkey="&searchkey&"&action="&action&"&anclassid="&anclassid&"&jiage="&jiage&">"  
				Response.Write "<p align='center' class='contents'> "  
				If CurrentPage<2 Then  
					Response.Write "<font class='contents'>首页 上一页</font> "  
				Else  
					Response.Write "<a href="&filename&"?page=1&searchkey="&searchkey&"&action="&action&"&anclassid="&anclassid&"&jiage="&jiage&" class='contents'>首页</a> "  
					Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&searchkey="&searchkey&"&action="&action&"&anclassid="&anclassid&"&jiage="&jiage&" class='contents'>上一页</a> "  
				End If
				If n-currentpage<1 Then  
					Response.Write "<font class='contents'>下一页 尾页</font>"  
				Else  
					Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&searchkey="&searchkey&"&action="&action&"&anclassid="&anclassid&"&jiage="&jiage&" class='contents'>"  
					Response.Write "下一页</a> <a href="&filename&"?page="&n&"&searchkey="&searchkey&"&action="&action&"&anclassid="&anclassid&"&jiage="&jiage&" class='contents'>尾页</a>"  
				End If  
					Response.Write "<font class='contents'> 页次:</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "  
					Response.Write "<font class='contents'> 共查讯到"&totalnumber&"种商品 " 
					Response.Write "<font class='contents'>转到:</font><input CLASS='wenbenkuang' type='text' name='page' size=2 maxlength=8 class=smallInput value="&currentpage&">"  
					Response.Write "&nbsp;<input type='submit' CLASS='go-wenbenkuang' class='contents' value='GO' name='cndok'></form></div>"  
				End Function%>
      <%
sub sss() '增加搜索关健字到数据库
if request.cookies("godbook")("username")<>"" then 
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from [user] where username='"&request.cookies("godbook")("username")&"'",conn,1,1
t_userid=rs_s("userid")
rs_s.close

set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from shop_his where username='"&request.cookies("godbook")("username")&"' and bookname='"&s_bookname&"' and lx=2",conn,1,3
if rs_s.recordcount>0 then 
	rs_s("ltime")=now()
	rs_s("userid")=t_userid
	rs_s("searchkey")=sql2
	rs_s.update
	rs_s.close
	set rs_s=nothing
else
		    	rs_s.close
		    	set rs_s=server.createobject("adodb.recordset")
		    	rs_s.open "select * from shop_his where username='"&request.cookies("godbook")("username")&"' and lx=2",conn,1,3
		    	if rs_s.recordcount>=4 then
		    	    rs_s.delete
		    	    rs_s.update
		    	end if
		    	rs_s.addnew
		    	    rs_s("username")=request.cookies("godbook")("username")
		    	    rs_s("searchkey")=sql2
		    	    rs_s("bookname")=s_bookname
			    rs_s("userid")=t_userid
		    	    rs_s("lx")=2
		    	    rs_s("ltime")=now()
		        rs_s.update
			rs_s.close
			set rs_s=nothing
		    end if
		end if
end sub%>
        </table>
		</div>
    </div>
	<!-- 主内容左侧 -->
	<div id="content_l">
		<!-- 公告 -->
		<div id="affiche"><h1>在我们的网站</h1><ul><li><a href="#">订购满200元,即有精美赠品;</a></li><li><a href="#">满500元还可免送货费..</a>.</li><li><a href="#">点击察看详情>></a></li></ul>
		<div class="clear-both">&nbsp;</div>
		</div>	
		<!-- 左侧目录 -->
		<div id="leftnav">
			<h1>商品目录</h1>
			<ul><li class="title"><a href="#">游戏</a></li>
			<li><a href="#">鲜花</a></li>
			<li><a href="#">礼品</a></li>
			<li><a href="#">玩具</a></li>
			<li><a href="#">模型</a></li>
			<li><a href="#">火机</a></li>
			<li><a href="#">趣味礼品</a></li>
			</ul>
<div class="clear-both">&nbsp;</div>
			<ul><li class="title"><a href="#">礼品</a></li>
			<li><a href="#">鲜花</a></li>
			<li><a href="#">玩具</a></li>
			<li><a href="#">火机</a></li>
			<li><a href="#">趣味礼品</a></li>
			</ul>
<div class="clear-both">&nbsp;</div>
			<ul><li class="title"><a href="#">模型</a></li>
			<li><a href="#">鲜花</a></li>
			<li><a href="#">礼品</a></li>
			<li><a href="#">玩具</a></li>
			<li><a href="#">模型</a></li>
			<li><a href="#">火机</a></li>
			<li><a href="#">趣味礼品</a></li>
			</ul>
<div class="clear-both">&nbsp;</div>
			<ul><li class="title"><a href="#">游戏</a></li>
			<li><a href="#">礼品</a></li>
			<li><a href="#">玩具</a></li>
			</ul>
			<ul><li class="title"><a href="#">礼品</a></li>
			<li><a href="#">礼品</a></li>
			<li><a href="#">模型</a></li>
			<li><a href="#">火机</a></li>
			<li><a href="#">趣味礼品</a></li>
			</ul>
<div class="clear-both">&nbsp;</div>
			<ul><li class="title"><a href="#">礼品/玩具</a></li>
			<li><a href="#">鲜花</a></li>
			<li><a href="#">礼品</a></li>
			<li><a href="#">趣味礼品</a></li>
			</ul>
			<ul><li class="title"><a href="#">模型/游戏</a></li>
			<li><a href="#">鲜花</a></li>
			<li><a href="#">礼品</a></li>
			</ul>
<div class="clear-both">&nbsp;</div>
		</div>
	</div>
</div>
<div class="clear-both">&nbsp;</div>
<!-- 服务声明 -->
<!--#include file="service.asp" -->
<!-- 版权信息 -->
<!--#include file="copyright.asp" -->
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -