<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%call checkmanage("03")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>

<BODY background="../images/admin/back.gif">
<%
action=request("action")
if action="" then
%>
<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px"  bordercolor="#333333" cellspacing="0" cellpadding="2">
<form name=search action=prod2.asp method=post>
<tr><td colspan=2 class=td height=18>产品高级搜索</td></tr>
<tr><td width=20% align=center>根据产品类别</td><td>
<%	Dim a,b,c 
	set rs=server.createobject("adodb.recordset") 
	sql="select distinct LarCode,LarSeq from hfvip_class order by LarSeq" 
	rs.Open sql,conn,1,1 
	response.write "<select name='fenlei'>"
	response.write	"<option value='' selected>选择要搜索的产品分类</option>"
	if rs.bof and rs.eof then
	response.write "<option selected value=''>-暂无分类-</option>"
	else
	Do While Not rs.eof	
	response.write "<option value='"&rs("larCode")&"'>"&rs("LarCode")&"</option>"
	rs.movenext
	  if rs.eof then exit do
	loop
	response.write "<option value='未归类'>所有未归类产品</option>"
	end if
	rs.close
	set rs=nothing
%>
</td></tr>
<tr><td width=20% align=center> 根据产品名称
</td><td><input type=text name=name_key size=40 maxlength=20></td></tr>
<td width=20% align=center>根据产品编号
</td><td><input type=text name=id_key size=40 maxlength=20></td></tr>
<td width=20% align=center>根据产品简介
</td><td><input type=text name=jj_key size=40 maxlength=20></td></tr>
<td width=20% align=center>根据产品内容
</td><td><input type=text name=nr_key size=40 maxlength=20></td></tr>
<td width=20% align=center>根据产品价格
</td><td>价格范围：从 <input type=text name=jg1_key size=5 maxlength=4> 元 至 <input type=text name=jg2_key size=5 maxlength=4> 元</td></tr>
<td width=20% align=center>根据是否推荐
</td><td><input type="radio" name="tj_key" value="1">是 <input type="radio" name="tj_key" value="2">否 <input type="radio" name="tj_key" value="3">全部</td></TR>
<td width=20% align=center>根据是否特价
</td><td><input type="radio" name="tej_key" value="1">是 <input type="radio" name="tej_key" value="2">否 <input type="radio" name="tej_key" value="3">全部</td></TR>
<td width=20% align=center>根据产品状态
</td><td><input type="radio" name="zt_key" value="1">显示 <input type="radio" name="zt_key" value="2">关闭 <input type="radio" name="zt_key" value="3">全部</td></TR>
<td width=20% align=center>搜索结果排序方式
</td><td><input type="radio" name="paixu" value="1" checked>时间降 <input type="radio" name="paixu" value="2">时间升<input type="radio" name="paixu" value="3">编号降 <input type="radio" name="paixu" value="4">编号升 <input type="radio" name="paixu" value="5">名称 <input type="radio" name="paixu" value="6">点击数</td></TR>

<tr><td colspan=2><INPUT name="action" TYPE="hidden" value="ok"><INPUT name=action TYPE="submit" value="开始搜索"></td></tr>
</table>

<br>
<font color=red>※提示：</font><br>支持模糊搜索，可根据一个或多个条件进行搜索，非搜索条件可空出。
<%
else

'开始搜索
if trim(request("jg1_key"))<>"" then
  if not isNumeric(trim(request("jg1_key"))) then
	response.write "<script language='javascript'>"
	response.write "alert('您填写的内容不符合要求，价格必须是数字，请检查！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
  end if
end if

if trim(request("jg2_key"))<>"" then
  if not isNumeric(trim(request("jg2_key"))) then
	response.write "<script language='javascript'>"
	response.write "alert('您填写的内容不符合要求，价格必须是数字，请检查！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
  end if
end if

	if request("name_key")<>"" then addsql=addsql+" and prodname like '%"&request("name_key")&"%'"
	if request("ID_key")<>"" then addsql=addsql+" and prodID like '%"&request("ID_key")&"%'"
	if request("jj_key")<>"" then addsql=addsql+" and ProdDisc like '%"&request("jj_key")&"%'"
	if request("nr_key")<>"" then addsql=addsql+" and MemoSpec like '%"&request("nr_key")&"%'"
	if request("tj_key")="1" then addsql=addsql+" and remark='1'"
	if request("tj_key")="2" then addsql=addsql+" and remark='0'"
	if request("zt_key")="1" then addsql=addsql+" and online=true"
	if request("zt_key")="2" then addsql=addsql+" and online=false"
	if request("tej_key")="1" then addsql=addsql+" and tejia='1'"
	if request("tej_key")="2" then addsql=addsql+" and tejia='0'"
	if request("fenlei")<>"" then addsql=addsql+" and larcode='"&request.form("fenlei")&"'"
	if trim(request("jg1_key"))<>"" then addsql=addsql+" and PriceList>"&request("jg1_key")
	if trim(request("jg2_key"))<>"" then addsql=addsql+" and PriceList<"&request("jg2_key")
	if request("paixu")="1" then orderby=" order by adddate desc"
	if request("paixu")="2" then orderby=" order by adddate"
	if request("paixu")="3" then orderby=" order by prodid desc"
	if request("paixu")="4" then orderby=" order by adddate"
	if request("paixu")="5" then orderby=" order by prodname"
	if request("paixu")="6" then orderby=" order by ClickTimes desc"

if addsql="" then
response.cookies("hfvipok")("sql")=""
Response.Redirect("prod2.asp")
else

sql="select * from hfvip_produc where ProdId is not null" + addsql +orderby
response.cookies("hfvipok")("sql")=sql
Response.Redirect("prod1.asp")
end if

end if
%>

</body>
</html>
