<%@ Language=VBScript %> <%Option Explicit%> <% if session("LastNameOnTop") & "" = "" AND session("UserID") & "" <> "" then%> <%end if dim oRs, oConn, SQL, i, RecipCategs, Data, Dataexist dim SearchStr, whereclause, SplitStr, IDs, RecCategID dim PageNo, tens, starting, ending, totalRows, totalPages dim MainDataExist, MainData, thisstyle RecipCategs = Application("RecCategs"&lang) SearchStr = Request.Form("SearchStr") RecCategID = Request.Form("RecCategID") PageNo = Request("PageNo") : if PageNo & "" = "" then PageNo = 1 tens = Request("tens") : if tens & "" = "" then tens = 1 MainDataExist = -1 if lang = "GR" then templang = "" else templang = "EN" set oConn = Server.CreateObject("ADODB.Connection") oConn.open Application("Constr") set oRs = Server.createObject("ADODB.Recordset") if SearchStr & "" <> "" then IDs = "" whereclause = " WHERE " SplitStr = Split(SearchStr," ") for i=0 to ubound(SplitStr) whereclause = whereclause & " Word like '%" & SplitStr(i) & "%' OR" next '=== Getting RecipeIDs ========= SQL = "Select DISTINCT RecipeID from RecipeHits where WordID in (Select WordID from RecipeWords " & left(whereclause, len(whereclause)-3) &")" oRs.open SQL, oConn, 3,1,1 while not oRs.EOF IDs = IDs & oRs("RecipeID") & "," oRs.MoveNext wend if Instr(IDs,",") >0 then IDs = left(IDs,len(IDs)-1) oRs.close if IDs & "" = "" then IDs = -1 SQL = "SearchRec '" & IDs & "', '" & templang &"', '" & RecCategID & "'," & PageSize & ", " & PageNo oRs.open SQL, oConn, 0, 1, 1 if oRs.state=0 then oRs.open SQL, oConn, 3, 1, 1 if oRs.EOF = false then totalRows = oRs("TotalRecs") if totalRows = 0 then MainDataExist = 0 else totalRows = oRs("TotalRecs") MainDataExist = 1 MainData = oRs.GetRows() totalPages = totalRows \ PageSize if totalRows mod PageSize > 0 then totalPages = totalPages + 1 end if oRs.close starting = ((tens-1)*10)+1 : ending = starting + 9 end if SQL = "Select top 1 RecipeID, RecipeName"&templang&", dbo.GetLessText(RecipeInfo"&templang&",30) as RecipeInfo, IsNull(RecipePhotos,'default.jpg'), IsNull(RecipeThumbs,'default.jpg'), RecipeMaterial"&templang&" from Recipe where RecipeShow=1 order by NewID()" oRs.open SQL, oConn, 3,1,1 if oRs.EOF = false then Data = oRs.GetRows() Dataexist = 1 end if GoToPage = "RecSearch.asp" menu = "2" %> <%=PageTitle%>
      <%=RTop1(lg)%>     <%=RTop2(lg)%>     <%=RTop3(lg)%>     <%=RTop4(lg)%>
<% if instr(Data(3,0),",") then dim c, b c = split(Data(3,0),",") b = ubound(c)+1 randomize b=Int((b * Rnd)+1) b = c(b-1) else b = Data(3,0) end if%>
" alt="" width="148" height="148" border="0">
<%=RTop1(lg)%>

<%=RSearchTxt(lg)%>

  

<%if MainDataExist = 1 then%>
<%=RPage(lg)%>   <% if pageno>10 then %>   <%end if for i = starting to ending if i <=totalpages then%> <%if Cint(i) = Cint(PageNo) then%><%=i%><%else%><%=i%><%end if%> <% else exit for end if next if i   <%end if%>
<% thisstyle = "table4" for i=0 to ubound(MainData,2)%>
" alt="" width="<%=photosize3x%>" height="<%=photosize3y%>" border="0">
<%=MainData(2,i)%>
<%=MainData(3,i)%>
<% if thisstyle = "table4" then thisstyle = "table8" else thisstyle = "table4" next%>
<%=RPage(lg)%>   <% if pageno>10 then %>   <%end if for i = starting to ending if i <=totalpages then%> <%if Cint(i) = Cint(PageNo) then%><%=i%><%else%><%=i%><%end if%> <% else exit for end if next if i   <%end if%>
 
<%elseif MainDataExist=0 then%>
<%=RNoRes(lg)%>
 
<%end if%>

<% set oRs = nothing oConn.close : set oConn = nothing %>