[color=#FF0000]源码:[/color]
<%
dim sql
dim rs
const PerPage=10
dim totalput
dim CurrentPage
dim TotalPage
dim filename
dim p_class,brand,p_field
dim search,keyword
dim cl,b_s
dim class1
cl=trim(request("cl"))
class1=trim(request("class"))
if not isempty(request("page")) and IsNumeric(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
keyword=trim(request("keyword"))
search=request("search")
p_class=request("p_class")
brand=request("brand")
p_field=request("p_field")
'=================Clear Session===================
if request("clear_session") then
Session("r_product_cl") = ""
Session("r_product_class1") = ""
Session("r_product_keyword") = ""
Session("r_product_search") = ""
Session("r_product_p_class") = ""
Session("r_product_brand") = ""
Session("r_product_p_field") = ""
end if
'=================Clear Session===================
'=================Session===================
if cl <> "" then Session("r_product_cl") = cl else cl = Session("r_product_cl")
if class1 <> "" then Session("r_product_class1") = class1 else class1 = Session("r_product_class1")
if search<>"" then
Session("r_product_keyword") = keyword
end if
if keyword <> "" then Session("r_product_keyword") = keyword else keyword = Session("r_product_keyword")
if request("page")<>"" then
if search <> "" then Session("r_product_search") = search else search = Session("r_product_search")
else
Session("r_product_search") = search
end if
if p_class <> "" then Session("r_product_p_class") = p_class else p_class = Session("r_product_p_class")
if brand <> "" then Session("r_product_brand") = brand else brand = Session("r_product_brand")
if p_field <> "" then Session("r_product_p_field") = p_field else p_field = Session("r_product_p_field")
'=================Session===================
if search=false then
filename="manage_product.asp?"
sql="select * from [prohot]"
if not cl="" and not class1="" then
if cl="p_class" then
sql="select * from [prohot] where "&cl&" in ("&class1 & get_p_class_type(class1)&")"
else
sql="select * from [prohot] where "&cl&"="&class1
end if
filename="manage_product.asp?cl="&cl&"&class="&class1&"&"
end if
else
sql="select * from [prohot] where (p_name like '%"&keyword&"%' or p_width like '%"&keyword&"%' or spec like '%"&keyword&"%' or intro like '%"&keyword&"%')"
if p_class<>"0" and p_class<>"" then
sql=sql & " and (p_class in ("&p_class & get_p_class_type(p_class)&"))"
end if
if brand<>"-1" then
sql=sql & " and brand="&brand
end if
filename="manage_product.asp?keyword="&keyword&"&search=true&p_class="&p_class&"&brand="&brand&"&p_field="&p_field&"&"
end if
sql=sql & " order by add_date desc,p_class desc,look_count desc,p_id desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
totalPut=rs.recordcount
if totalput mod perpage=0 then
totalpage=totalput\perpage
else
totalpage=totalput\perpage+1
end if
if currentPage<1 then
currentPage=1
end if
if currentPage>totalpage then
currentPage=totalpage
end if
if not rs.eof then
rs.move (currentPage-1)*perpage
end if
function get_p_class(type_id)
dim rs
set rs=server.createobject("adodb.recordset")
rs.open "select * from [p_class] where id="&type_id,conn
if not rs.eof then
'if rs("layer")>0 then
' get_p_class = get_p_class(rs("parent")) & " _> " & Server.HTMLEncode(rs("c_name"))
'else
get_p_class = Server.HTMLEncode(rs("c_name"))
'end if
else
get_p_class = "未知类别"
end if
rs.close
set rs=nothing
end function
function get_p_brand(brand_id)
dim rs
set rs=server.createobject("adodb.recordset")
rs.open "select * from [brand] where id="&request("id"),conn
if not rs.eof then
get_p_brand = Server.HTMLEncode(rs("name"))
else
get_p_brand = "无品牌"
end if
rs.close
set rs=nothing
end function
%>