<%@ Language=VBScript%> <%Option Explicit%> <% dim RecipeID, RecCatID, ChefID dim oConn, SQL, oRs,RecipeOK RecipeOK=true RecipeID = Request.Form("RecipeID") RecCatID = Request.Form("RecipeCategID") ChefID = Request.Form("ChefID") : if ChefID & "" = "" then ChefID = "null" if RecipeID = "" OR RecCatID = "" OR ChefID = "" 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 RecipeID From Recipe where RecipeID=" & RecipeID oRs.open SQL, oConn,3,1,1 If oRs.EOF = true then RecipeOK=false oRs.close if session("UserID") & "" = "" then response.redirect("account.asp?fromrecipes=1") SQL = "Select UName from [User] where UID="&session("UserID") oRs.open SQL, oConn,3,1,1 If not oRs.EOF then oRs.close SQL = "Select RBID from RecipeBox where UID= " & session("UserID")& " AND RecipeID = " & RecipeID oRs.open SQL, oConn,3,1,1 if oRs.EOF = true then 'Den uparxei h suntagh ston xrhsth If RecipeOK=false then Response.Redirect "error.asp" Else SQL = "Insert Into RecipeBox values (" & session("UserID")& ", " & RecipeID & ", " & ChefID & ", " & RecCatID & ")" oConn.execute SQL End if else server.transfer("my_recipe_box.asp") end if Else server.transfer("account.asp") End if oConn.close : set oConn = nothing server.transfer("my_recipe_box.asp") %>