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

📄 rexsearchp.asp

📁 IMPORTANT YOU SHOUD LOAD IT DOWN FOR USING
💻 ASP
字号:
<!--#include file="conn_xp/xp.asp"-->
<!--#include file="conn_xp/shopxp.asp"-->
<%
dim action,searchkey,shopxpbe_id,jiage,selectname
shopxpbe_id=request("shopxpbe_id")
searchkey=request("searchkey")
jiage=request("jiage")
action=request("action")
selectname=request("selectname")
if InStr(searchkey,"'")>0 then
response.write"<script>alert(""非法访问!"");location.href=""../index.asp"";</script>"
response.end
end if
if shopxpbe_id<>"" then
if not isnumeric(shopxpbe_id) then 
response.write"<script>alert(""非法访问!"");location.href=""../index.asp"";</script>"
response.end
end if
end if

if jiage<>"" then
if not isnumeric(jiage) then 
response.write"<script>alert(""非法访问!"");location.href=""../index.asp"";</script>"
response.end
end if
end if

if action<>"" then
if not isnumeric(action) then 
response.write"<script>alert(""非法访问!"");location.href=""../index.asp"";</script>"
response.end
end if
end if

%>
<html><head><title><%=webname%>--商品搜索结果</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="img_shopxp/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--#include file="xptop.asp"-->
<TABLE cellSpacing=0 cellPadding=0 width=90% border=0>
  <TBODY>
    <TR> 
	  <td width="100%" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-you">
        <tr>
          <td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td height=33><%if jiage="" then%>
                    <%if searchkey="" then
		response.write "<script language=javascript>alert('对不起,请您输入查讯关键字');history.go(-1);</script>"
		response.End
	      else
		response.write " 您查讯的关键字是: "
		if shopxpbe_id<>0 then
			set rs=server.CreateObject("adodb.recordset")
			rs.open "select * from shopxp_btype where shopxpbe_id="&shopxpbe_id,conn,1,1
			response.write "<a href=xpCatalog_xpDesc.asp?action_key_order=big&shopxpbe_id="&shopxpbe_id&"><font color=red>"&rs("shopxpbe_name")&"</font></a>"&" &gt;&gt; "
			rs.close
			set rs=nothing
		end if
		response.write "<font color=red>"&searchkey&"</font>"
		s_bookname=searchkey
	      end if%>
                    <%else%>
                    <%if (action="1" or action="3") and searchkey="" then
		response.write "<script language=javascript>alert('对不起,请您输入查讯关键字');history.go(-1);</script>"
		response.End
	      else
           if action="2" then
           set rs=server.createobject("adodb.recordset")
           rs.open "select * from shopxp_pingpai where tuijian=1 order by pingpaiorder",conn,1,1
           if rs.recordcount>0 then
           response.write " 商品品牌:"
           for i=1 to rs.recordcount
           response.write " <a href=rexsearchp.asp?action=2&shopxpbe_id=0&selectname="&trim(rs("pingpainame"))&"&jiage=1000000><font color=blue>"&trim(rs("pingpainame"))&"</font></a>&nbsp;&nbsp;"
           rs.movenext
           next
           rs.close
           set rs=nothing
           response.write "<br>"
           end if
        
           end if
	        response.write " 您查讯的关键字是: "
		    if shopxpbe_id<>0 then
			set rs=server.CreateObject("adodb.recordset")
			rs.open "select * from shopxp_btype where shopxpbe_id="&shopxpbe_id,conn,1,1
			response.write "<a href=xpCatalog_xpDesc.asp?action_key_order=big&shopxpbe_id="&shopxpbe_id&"><font color=red>"&rs("shopxpbe_name")&"</font></a>"&" &gt;&gt; "
			rs.close
			set rs=nothing
		    end if
		if action="1" or action="3" then 
			response.write "<font color=red>"&searchkey&"</font>"
			s_bookname=searchkey
		else
			response.write "<font color=red>"&selectname&"</font>"
			s_bookname=selectname
end if
end if%>
                    <%end if%></td>
              </tr>
            </table>
              <%'开始分页
				Const MaxPerPage=10
   				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&"&shopxpbe_id="&shopxpbe_id
select case request("shopxpbe_id")
case "0"
sql1=" shopxpptname like '%"&searchkey&"%' "
case else
sql1=" shopxpptname like '%"&searchkey&"%' and shopxpbe_id="&request("shopxpbe_id")&" "
end select
else
'//高级查讯
sql2="searchkey="&searchkey&"&shopxpbe_id="&shopxpbe_id&"&jiage="&jiage&"&action="&action&"&selectname="&selectname
if shopxpbe_id<>0 then  '//判断查讯分类,分类不为空。  
select case action
case "1"
sql1=" shopxpptname like '%"&searchkey&"%' and (shichangjia<"&jiage&" or shopxphyjia<"&jiage&" or shopxpvjia<"&jiage&") and shopxpbe_id="&shopxpbe_id&" "
case "2"
sql1=" pingpai like '%"&selectname&"%' and (shichangjia<"&jiage&" or shopxphyjia<"&jiage&" or shopxpvjia<"&jiage&") and shopxpbe_id="&shopxpbe_id&" "
case "3"
sql1=" shopxpptcontent like '%"&selectname&"%' and (shichangjia<"&jiage&" or shopxphyjia<"&jiage&" or shopxpvjia<"&jiage&") and shopxpbe_id="&shopxpbe_id&" "
end select
else
'//分类为空。
select case action
case "1"
sql1=" shopxpptname like '%"&searchkey&"%' and (shichangjia<"&jiage&" or shopxphyjia<"&jiage&" or shopxpvjia<"&jiage&") "
case "2"
sql1=" pingpai like '%"&selectname&"%' and (shichangjia<"&jiage&" or shopxphyjia<"&jiage&" or shopxpvjia<"&jiage&") "
case "3"
sql1=" shopxpptcontent like '%"&selectname&"%' and (shichangjia<"&jiage&" or shopxphyjia<"&jiage&" or shopxpvjia<"&jiage&") "
end select
end if
end if
call sss()
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shopxp_product 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,"rexsearchp.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"rexsearchp.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"rexsearchp.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0
			%>
              <table width=100% align=center class=table-shang border=0 cellpadding=0 cellspacing=0 bgcolor=#f1f1f1>
                <TR>
                  <TD bgColor=#ffffff colSpan=3 height=1></TD>
                <TR>
                <tr>
                  <td align=center width=20% height=30>产品预览</td>
                  <td align=center width=60% height=30>产品名称</td>
                  <td align=center width=20% height=30>产品价格</td>
                </tr>
                <TR>
                  <TD bgColor=#cccccc colSpan=3 height=1></TD>
                </TR>
                <TR>
                  <TD bgColor=#f1f1f1 colSpan=3 height=3></TD>
                </TR>
              </table>
            <%do while not rs.eof%>
              <table width="100%" class="table-xia" border="0" cellspacing="0" cellpadding="0" align="center">
                <tr>
                  <td width="20%" rowspan="4" class="table-you"><table align=center cellspacing=0 cellpadding=0 width=100 height=100 border=0>
                      <tbody>
                        <tr>
                          <td background=img_shopxp/xt_bj.gif align=center><%if rs("upfilepic")="" then 
response.write "<div align=center><a href=productshopxp.asp?id="&rs("shopxpptid")&" ><img src=img_shopxp/emptybook.gif width=75 height=75 border=0></a></div>"
else%>
                              <a href=productshopxp.asp?id=<%=rs("shopxpptid")%> ><img src="<%=trim(rs("upfilepic"))%>"  width=75 border=0 height="75"></a>
                              <%end if%>
                          </td>
                        </tr>
                      </tbody>
                  </table></td>
                  <td width="2%"><div align="center"> </div></td>
                  <td width="58%"><%response.write "<a href=productshopxp.asp?id="&trim(rs("shopxpptid"))&" >"&trim(rs("shopxpptname"))&"</a>"%></td>
                  <td width="20%" rowspan="4" class="table-zuo"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td align=center valign="middle"> 市场价:<s><%=rs("shichangjia")&"元"%></s><br>
                          会员价:<%="<font color=#FF6600>"&rs("shopxphyjia")&"元</font>"%> </td>
                      </tr>
                  </table></td>
                </tr>
                <tr>
                  <td colspan="2" valign="top"><font color="#666666">&nbsp; <%=trim(rs("isbn"))%> </font></td>
                </tr>
              </table>
            <%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 "<form method=Post action="&filename&"?searchkey="&searchkey&"&action="&action&"&shopxpbe_id="&shopxpbe_id&"&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&"&shopxpbe_id="&shopxpbe_id&"&jiage="&jiage&" class='contents'>首页</a> "  
					Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&searchkey="&searchkey&"&action="&action&"&shopxpbe_id="&shopxpbe_id&"&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&"&shopxpbe_id="&shopxpbe_id&"&jiage="&jiage&" class='contents'>"  
					Response.Write "下一页</a> <a href="&filename&"?page="&n&"&searchkey="&searchkey&"&action="&action&"&shopxpbe_id="&shopxpbe_id&"&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>"  
				End Function  
			%>
              <%
sub sss() '增加搜索关健字到数据库
if request.Cookies("shopxp")("username")<>"" then 
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from [Dv_User] where username='"&request.Cookies("shopxp")("username")&"'",conn,1,1
t_userid=rs_s("userid")
rs_s.close

set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from shopxp_his where username='"&request.Cookies("shopxp")("username")&"' and shopxpptname='"&s_bookname&"' and action_key_order=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 shopxp_his where username='"&request.Cookies("shopxp")("username")&"' and action_key_order=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("shopxp")("username")
		    	    rs_s("searchkey")=sql2
		    	    rs_s("shopxpptname")=s_bookname
			    rs_s("userid")=t_userid
		    	    rs_s("action_key_order")=2
		    	    rs_s("ltime")=now()
		        rs_s.update
			rs_s.close
			set rs_s=nothing
		    end if
		end if
end sub%>
          </td>
        </tr>
      </table></td>
    </tr>
</table>
      </TR>
      </TBODY>
      </TABLE>
<!--#include file="copyright_shopxp.asp"-->
</body>
</html>

⌨️ 快捷键说明

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