%@ Language=VBScript %> <%Option Explicit%> <% if session("LastNameOnTop") & "" = "" AND session("UserID") & "" <> "" then%> <%end if dim CategID, MainCategs, MainCategDescr, i, SubCategs, a dim oRs, oConn, SQL, DataExist, ShowFirst dim RecipeExist, ShowRecipes, RecPhotos, SplitRecPhotos dim tempid, splittempid RecPhotos = "" : tempid = "" MainCategs = Application("ProdCategs"&lang) SubCategs = Application("ProdSubCategs"&lang) CategID = Request.Form("CategID") if CategID="" then Response.Redirect("error.asp") end if set oConn = Server.CreateObject("ADODB.Connection") oConn.open Application("ConStr") set oRs = Server.CreateObject("ADODB.RecordSet") SQL = "SELECT TOP 4 ShowFirst.SFProdID, ProdDescr.ProdDescr, ProdDescr.ProdDescrEN, ShowFirst.SFExtraText, ShowFirst.SFExtraTextEN, IsNull(Product.ProdThumbs,'default.jpg') , ShowFirst.CategID "&_ " FROM ShowFirst "&_ " LEFT OUTER JOIN Product on ProdID = SFProdID"&_ " LEFT OUTER JOIN ProdDescr on ProdDescr.ProdDescrID = Product.ProdDescrID"&_ " where SFPage='categ' AND CategID=" & CategID & " order by NEWID()" oRs.open SQL, oConn, 3,1,1 if oRs.EOF = false then DataExist = 1 ShowFirst = oRs.GetRows() end if oRs.close SQL = "Select RecCat.RecipeID, Recipe.RecipeName, Recipe.RecipeNameEN, Recipe.RecipePhotos from RecCat "&_ " LEFT OUTER JOIN Recipe on Recipe.RecipeID = RecCat.RecipeID" &_ " where RecCat.ProdCategID = " & CategID & " AND Recipe.RecipeShow = 1 order by Recipe.RecipeName" oRs.open SQL, oConn, 3,1,1 if oRs.EOF = false then RecipeExist = 1 ShowRecipes = oRs.GetRows() '---------------------------------------------------------------------------------------- for i=0 to ubound(ShowRecipes,2) if ShowRecipes(3,i) & "" <> "" then RecPhotos = RecPhotos & ShowRecipes(3,i) & "," tempid = tempid & ShowRecipes(0,i) & "," end if next if RecPhotos & "" <> "" then SplitRecPhotos = split(RecPhotos,",") Splittempid = split(tempid,",") a = ubound(SplitRecPhotos) randomize a=Int((a * Rnd)+1) RecPhotos = SplitRecPhotos(a-1) tempid = Splittempid(a-1) else RecPhotos = "default.jpg" end if '---------------------------------------------------------------------------------------- end if GoToPage = "categ.asp?CategID=" & CategID menu = "1" %>