%@ Language=VBScript %><% '************************************************************ '* * '* By Downloading or using this software, you agree to * '* the terms and conditions as stated in the Software * '* License Agreement. An updated copy of this agreement * '* can be seen at http://www.pagedowntech.com/terms. * '* * '* NOTICE: We do not recommend changing the code below * '* as it may interfere with future updates/upgrades. * '* * '* PageDown Technology, LLC., Copyright 2005. * '* www.pagedowntech.com * '* * '************************************************************ %> <% cartid = Request.cookies("cartid") giftid=request("giftid") task=request("task") 'Check for cart session id, if none then create one. if cartid="" then Randomize Dim MyNum temp1 = replace(Time, " ", "") temp1 = replace(temp1, ":", "") temp2 = replace(date, " ", "") temp2 = replace(temp2, "/", "") temp2 = replace(temp2, ".", "") cartid = temp2 & temp1 & Int((9999999999- 5 + 1) * Rnd + 5) Response.Cookies("cartid")= cartid end if sentto=request.form("sentto") sentfrom=request.form("sentfrom") fixamount=request.form("fixamount") varamount=request.form("varamount") message=request.form("message") recipemail=request.form("recipemail") method=request.form("method") amtmethod=request.form("amtmethod") if amtmethod="1" then amount=varamount else amount=fixamount end if recipname=Pcase(request("recipname")) recipstreet1=Pcase(request("recipstreet1")) recipstreet2=Pcase(request("recipstreet2")) recipcity=Pcase(request("recipcity")) recipstate=request("recipstate") recipzip=request("recipzip") recipcountry=request("recipcountry") 'If form is submitted. if task="update" or task="add" then 'Check for Form for errors --------------- errormessage="" call checkForm(sentto,getsystext("sys68"),"T",3,50) call checkForm(sentfrom,getsystext("sys69"),"T",3,50) call checkForm(amount,getsystext("sys70"),"N",0,0) call checkForm(message,getsystext("sys71"),"T",0,255) if method="1" then call checkForm(recipemail,getsystext("sys73"),"T",3,50) call checkForm(recipname,getsystext("sys26"),"T",0,50) call checkForm(recipstreet1,getsystext("sys28"),"T",0,50) call checkForm(recipstreet2,getsystext("sys28"),"T",0,50) call checkForm(recipstate,getsystext("sys30"),"T",0,50) call checkForm(recipcity,getsystext("sys29"),"T",0,50) call checkForm(recipzip,getsystext("sys31"),"T",0,50) call checkForm(recipcountry,getsystext("sys32"),"T",0,50) end if if method="2" then call checkForm(recipname,getsystext("sys26"),"T",3,50) call checkForm(recipstreet1,getsystext("sys28"),"T",3,50) call checkForm(recipstreet2,getsystext("sys28"),"T",0,50) call checkForm(recipstate,getsystext("sys30"),"T",2,50) call checkForm(recipcity,getsystext("sys29"),"T",2,50) call checkForm(recipzip,getsystext("sys31"),"T",0,50) call checkForm(recipcountry,getsystext("sys32"),"T",1,50) if state<>"OT" then call checkForm(recipzip,getsystext("sys31"),"T",5,50) end if end if 'If no errors on form, Enter Order header in Database. if errormessage=NULL or errormessage="" then if task="add" then Set rsmod = Server.CreateObject("ADODB.Recordset") 'Create Gift Cert Record rsmod.Open "Select * From giftcert", DB, 1, 3 rsmod.AddNew rsmod("code") = cartid rsmod("amount") = saveCurr(amount) rsmod("status") = 0 rsmod("method") = method rsmod("orderid") = 0 rsmod("buydate")=date rsmod("recipname")=recipname rsmod("recipstreet1")=recipstreet1 rsmod("recipstreet2")=recipstreet2 rsmod("recipcity")=recipcity rsmod("recipstate")=recipstate rsmod("recipzip")=recipzip rsmod("recipcountry")=recipcountry rsmod("recipphone")=recipphone rsmod("recipemail")=recipemail rsmod("sentfrom")=sentfrom rsmod("sentto")=sentto rsmod("message")=message rsmod.Update giftid=rsmod("id") rsmod.Close 'Add to Shopping Cart rsmod.Open "Select * From orderdetail", DB, 1, 3 rsmod.AddNew rsmod("cartid") = cartid rsmod("itemno") = 0 rsmod("price") = saveCurr(amount) rsmod("qty") = saveNum(1) rsmod("weight") = saveNum(0) 'rsmod("optiondesc") = heads14 rsmod("subof")=0 rsmod("digital") = "GC" rsmod("taxable")= "No" rsmod("giftid")= giftid rsmod.Update rsmod.Close set rsmod=nothing response.cookies("buygc")="Y" pdformredirect(shopcarturl) end if if task="update" then Set rsmod = Server.CreateObject("ADODB.Recordset") 'Update Gift Cert Record rsmod.Open "Select * From giftcert WHERE id=" & giftid & " AND code='" & cartid & "'", DB, 1, 3 rsmod("amount") = saveCurr(amount) rsmod("method") = method rsmod("recipname")=recipname rsmod("recipstreet1")=recipstreet1 rsmod("recipstreet2")=recipstreet2 rsmod("recipcity")=recipcity rsmod("recipstate")=recipstate rsmod("recipzip")=recipzip rsmod("recipcountry")=recipcountry rsmod("recipphone")=recipphone rsmod("recipemail")=recipemail rsmod("sentfrom")=sentfrom rsmod("sentto")=sentto rsmod("message")=message rsmod.Update rsmod.Close rsmod.Open "Select * From orderdetail WHERE giftid=" & giftid & " AND cartid='" & cartid & "'", DB, 1, 3 rsmod("price") = saveCurr(amount) rsmod.Update rsmod.Close set rsmod=nothing pdformredirect(shopcarturl) end if end if end if if task="" then nexttask="add" end if if task="edit" then 'Get Certificate Record. set rs=openrs("SELECT * FROM giftcert WHERE id=" & giftid & " AND code='" & cartid & "'") if rs.eof then pdredirect("error.asp") end if code=rs("code") amount=rs("amount") status=rs("status") method=rs("method") message=rs("message") sentfrom=rs("sentfrom") sentto=rs("sentto") recipphone=rs("recipphone") recipname=rs("recipname") recipstreet1=rs("recipstreet1") recipstreet2=rs("recipstreet2") recipcity=rs("recipcity") recipstate=rs("recipstate") recipzip=rs("recipzip") recipcountry=rs("recipcountry") recipemail=rs("recipemail") rs.close set rs=nothing nexttask="update" end if 'Open database get records. giftoptmatch="" set rs=openrs("SELECT * FROM giftopt ORDER BY amount") if not rs.eof then rs.movefirst while not rs.eof tempamount=rs("amount") if tempamount=amount then amtmethod=2 giftoptmatch="Y" end if rs.movenext wend end if rs.close set rs=nothing if giftoptmatch="" then amtmethod="1" varamount=amount end if zpage=pg10 %> <% getleftside(zpage)%> <% getsecspace ()%> <% getHeading "heads14", heads14, "", 2 %>