<% '********************************************************************** '** init ************************************************************** '********************************************************************** dim id, type1, type2, width_min, width_max, length_min, length_max, price_min, price_max, area, country id = Request("id") type1 = Request("type1") type2 = Request("type2") width_min = Request("width_min") width_max = Request("width_max") length_min = Request("length_min") length_max = Request("length_max") price_min = Request("price_min") price_max = Request("price_max") area = Request("area") country = Request("country") '********************************************************************** '** dbConnect ********************************************************* '********************************************************************** Set DB = Server.CreateObject("ADODB.Connection") VPath = Request.ServerVariables("PATH_INFO") VPath = Left(VPath, InStrRev(VPath, "/main/")) DefDir = Request.ServerVariables("PATH_TRANSLATED") DefDir = Left(DefDir, InStrRev(DefDir, "\main\")) DB.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath(VPath & "carpets/database.mdb") & ";DefaultDir=" & DefDir & "carpets;UID=admin;PWD=1919;" DB.Open '********************************************************************** '** dbSearch ********************************************************** '********************************************************************** dim items SQLQuery = "SELECT * FROM Products WHERE Status = 'InStock' and Online = true " If (id = "") Then If (Type1 = "on") and (Type2 <> "on") Then SQLQuery = SQLQuery & "and Type = 'Ęgte tęppe' " If (Type1 <> "on") and (Type2 = "on") Then SQLQuery = SQLQuery & "and Type = 'Kelim' " If (width_min <> "") Then SQLQuery = SQLQuery & "and Width >= " & width_min & " " If (width_max <> "") Then SQLQuery = SQLQuery & "and Width <= " & width_max & " " If (length_min <> "") Then SQLQuery = SQLQuery & "and Length >= " & length_min & " " If (length_max <> "") Then SQLQuery = SQLQuery & "and Length <= " & length_max & " " If (price_min <> "") Then SQLQuery = SQLQuery & "and Price >= " & price_min & " " If (price_max <> "") Then SQLQuery = SQLQuery & "and Price <= " & price_max & " " If (area <> "") Then SQLQuery = SQLQuery & "and Area = '" & area & "' " If (country <> "") Then SQLQuery = SQLQuery & "and Country = '" & country & "' " SQLQuery = SQLQuery & "ORDER BY Id ASC" Else SQLQuery = SQLQuery & "and Id = '" & id & "'" End If Set DB_Response = DB.Execute(SQLQuery) items = 0 While Not DB_Response.EOF DB_Response.MoveNext items = items + 1 Wend Set DB_Response = DB.Execute(SQLQuery) '********************************************************************** '** pageNavigator ***************************************************** '********************************************************************** dim pageSize, page pageSize = Request("pagesize") If IsNumeric(pageSize) Then pageSize = Cint(pageSize) If pageSize < 1 Then pageSize = 30 End If Else pageSize = 30 End If page = Request("page") If IsNumeric(page) Then page = Cint(page) If page < 1 Then page = 1 End If Else page = 1 End If If items > pageSize Then pageCounter = int(page / 10) * 10 i = pageCounter If i < 1 Then i = 1 End If If page > 1 Then leftNav = "<<" End If While (i-1) * pageSize <= items And i <= pageCounter + 10 If i = page Then numNav = numNav & "" & i & "" Else numNav = numNav & "" & i & "" End IF i = i + 1 Wend If pageSize * page =< items Then rightNav = ">>" End If pageNavigator = "
" pageNavigator = pageNavigator & leftNav pageNavigator = pageNavigator & numNav pageNavigator = pageNavigator & rightNav pageNavigator = pageNavigator & "

" End If Response.Write pageNavigator '********************************************************************** '********************************************************************** '********************************************************************** dim record, record_min, record_max record = 1 record_min = (page * pageSize) - pageSize + 1 record_max = page * pageSize %><% Do While Not DB_Response.EOF If Not DB_Response.EOF Then If record >= record_min and record <= record_max Then If record <> record_min Then %> <% End If %> <% End If record = record + 1 DB_Response.MoveNext End If If Not DB_Response.EOF Then If record >= record_min and record <= record_max Then If record <> record_min Then %> <% End If %> <% End If record = record + 1 DB_Response.MoveNext End If Loop '********************************************************************** '** dbClose *********************************************************** '********************************************************************** DB.Close set DB = nothing '********************************************************************** '********************************************************************** '********************************************************************** %>

.jpg" alt=""> <%= DB_Response("Area")%>, <%= DB_Response("Country")%>
<%= DB_Response("Width") %>x<%= DB_Response("Length")%>  kr. <%= DB_Response("Price")%>
<%= DB_Response("Description")%>


<%= DB_Response("Area")%>, <%= DB_Response("Country")%>
<%= DB_Response("Width") %>x<%= DB_Response("Length")%>  kr. <%= DB_Response("Price")%>
<%= DB_Response("Description")%>

.jpg" alt="">
<% Response.Write pageNavigator %>