<% function SendMail(conf) Dim Mail dim conn, rs, rs2, rs3 set conn = Server.Createobject("adodb.connection") set rs = server.createobject("adodb.recordset") set rs2 = server.createobject("adodb.recordset") set rs3 = server.createobject("adodb.recordset") conn.open connstr rs.open "select * from orders where id = "&session("orderid"),conn,3,1 if rs.eof then exit function end if email=rs("email")&"" shippingname = rs("shippingname")&"" shippingaddress1 = rs("shippingaddress1")&"" shippingaddress2 = rs("shippingaddress2")&"" shippingcity = rs("shippingcity")&"" shippingstate = rs("shippingstate")&"" shippingzip = rs("shippingzip")&"" shippingcountry = rs("shippingcountry")&"" billingname = rs("billingname")&"" billingaddress1 = rs("billingaddress1")&"" billingaddress2 = rs("billingaddress2")&"" billingcity = rs("billingcity")&"" billingstate = rs("billingstate")&"" billingzip = rs("billingzip")&"" billingcountry = rs("billingcountry")&"" shippingmethod = rs("shippingmethod")&"" shipping = rs("shipping")&"" subtotalprice = rs("subtotalprice")&"" tax = rs("tax")&"" ordertotal = rs("ordertotal")&"" instructions = rs("instructions")&"" if shippingmethod=2 then method= "UPS Ground" elseif shippingmethod=3 then method= "UPS 3rd Day" elseif shippingmethod=4 then method= "UPS 2nd day" elseif shippingmethod=5 then method= "UPS Next Day" elseif shippingmethod=6 then method= "UPS Standard" elseif shippingmethod=7 then method= "UPS Expedited" elseif shippingmethod=8 then method= "UPS Express" elseif shippingmethod=9 then method= "UPS Express" elseif shippingmethod=10 then method= "UPS Expedited" elseif shippingmethod=11 then method= "Saver" elseif shippingmethod=1 then method = "USPS" else method = "NONE" end if rs.close rs2.open "select count(*) from orderdetail where orderid = " & orderid, conn,3,3 count = rs2(0) rs2.close redim code(count), desc(count), qtys(count),prices(count),totalprice(count) totwt=0 totprice=0 i=0 numitems=0 rs2.open "select * from orderdetail where orderid = " & orderid, conn, 3,3 do while not rs2.eof rs3.open "select * from products where id = " & rs2("productid"),conn,3,1 if not rs3.eof then qty = rs2("qty") unitprice = rs2("unitprice") totalprice1 = rs2("totalprice") code(i)=rs3("code") desc(i)=rs3("name") if rs2("altcode") &"" <> "" then code(i)=rs2("altcode")&"" desc(i)= desc(i) & " - " &rs2("option") end if prices(i)=unitprice qtys(i)=qty totalprice(i)=totalprice1 i=i+1 end if rs3.close rs2.movenext loop rs2.close conn.close Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = "mail.webfoot.net" Mail.Port = 25 ' Optional. Port is 25 by default Mail.From = "info@luckysupply.com" ' Mail.AddAddress "Luckys@tampabay.rr.com" 'Mail.AddBCC "juan@webfoot.net" Mail.AddAddress email Mail.Subject = "Your LuckySupply Order - ID " & session("orderID") s = "Order ID: " & session("orderID") & chr(13) & chr(10) s = s & "Thank you for your order with Lucky Supply"&chr(13)&chr(10)&chr(13)&chr(10) s = s & "Your order will be shipped by "& method &" to: "&chr(13)&chr(10) s = s & shippingname &chr(13)&chr(10) s = s & shippingaddress1 &chr(13)&chr(10) if shippingaddress2 <>"" then s = s & shippingaddress2 &chr(13)&chr(10) end if s = s & shippingcity & ", " & shippingstate &" " & shippingzip &chr(13)&chr(10) s = s & shippingcountry &chr(13)&chr(10) s = s & chr(13)&chr(10)&chr(13)&chr(10) s = s & "Your order will be billed to: "&chr(13)&chr(10) s = s & billingname &chr(13)&chr(10) s = s & billingaddress1 &chr(13)&chr(10) if billingaddress2 <>"" then s = s & billingaddress2 &chr(13)&chr(10) end if s = s & billingcity & ", " & billingstate &" " & billingzip &chr(13)&chr(10) s = s & shippingcountry &chr(13)&chr(10) s = s & chr(13)&chr(10)&chr(13)&chr(10) if instructions <> "" then s = s & "Your special instructions: "&chr(13)&chr(10) s = s & instructions & chr(13) & chr(10) end if s = s & chr(13)&chr(10)& "Confirmation number: "& conf &chr(13)&chr(10) s = s & chr(13)&chr(10)&chr(13)&chr(10) s = s & "Your ordered items are: "&chr(13)&chr(10) for i = 0 to count -1 s = s &" " & code(i) &" - " & desc(i) &chr(13)&chr(10) s = s &" " & qtys(i) & " at " & formatcurrency(prices(i)) & " each" if qtys(i) > 1 then s = s & " ===> " & formatcurrency(totalprice(i)) end if s = s & chr(13) & chr(10) next s = s & chr(13)&chr(10)&chr(13)&chr(10) s = s & "Subtotal: "&formatcurrency(subtotalprice) & chr(13)&chr(10) s = s & "COD: " & formatcurrency( 9) & chr(13)&chr(10) if isnumeric(tax &"") then s = s & "Tax: "&formatcurrency(tax) & chr(13)&chr(10) end if s = s & "Shipping: "&formatcurrency(ordertotal - tax - 9 - subtotalprice) & chr(13)&chr(10) s = s & "Total: "&formatcurrency(ordertotal) & chr(13)&chr(10) s = s & chr(13)&chr(10)&chr(13)&chr(10) s = s & chr(13)&chr(10)&chr(13)&chr(10) s = s & "Items may be subject to backorder. Customer may be contacted in case item is out of stock."& chr(13)&chr(10) s = s & "If you have any questions, please contact us at "& chr(13)&chr(10) s = s & "info@luckysupply.com"&chr(13)&chr(10) s = s & chr(13)&chr(10)&chr(13)&chr(10) On Error Resume Next Mail.Body = s Mail.Send If Err <> 0 Then SendMail= False else SendMail = True End If set Mail = nothing end function function msg(zeroed) Dim Mail Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = "mail.webfoot.net" Mail.Port = 25 ' Optional. Port is 25 by default Mail.From = "info@luckysupply.com" Mail.AddBCC "juan@webfoot.net" Mail.Subject = "Out of stock item " s = "The following item(s) have been marked as out of stock in the website: " & zeroed & chr(13) & chr(10) On Error Resume Next Mail.Body = s Mail.Send If Err <> 0 Then Msg= False else Msg= True End If set Mail = nothing end function Function ChargeCard(ccnum, exp1, exp2, amount, comment,respmsg,email,comment2,pnref) fdebug=1 ExpireMe = ""&Exp1&""&Exp2&"" Exp3 = "'"&Exp1&chr(47)&Exp2&"'" 'webfoot / berghoffcm / centric2004 merchantPW="centric2004" 'serverpfp="test-payflow.verisign.com" serverpfp="connect.signio.com" merchantId="berghoffcm" Vendor = "berghoffcm" Partner = "webfoot" if fdebug <> 1 then 'Create the Signio COM Client Set client = Server.CreateObject("PFProCOMControl.PFProCOMControl.1") 'set the host address client.HostAddress = serverpfp 'set the host port client.HostPort = 443 'set the timeout value client.TimeOut = 30 'turn on debug mode... see COM Client docs for more information client.DebugMode = 1 'build the parameter list, such that we have a sale transaction and 'a credit card tender. parmList = "TRXTYPE=S&TENDER=C" parmList = parmList + "&ACCT=" & ccnum 'set the account form the html form parmList = parmList + "&PWD=" & merchantPW 'set the password from the html form parmList = parmList + "&USER=" & merchantId 'set the userid from the HTML form parmList = parmList + "&PARTNER=" & Partner 'set the Partner parmList = parmList + "&VENDOR=" & Vendor 'set the Vendor parmList = parmList + "&EXPDATE=" & ExpireMe 'set the expiration date form the HTML form parmList = parmList + "&AMT=" & amount 'set the amount from the HTML form parmList = parmList + "&COMMENT1=" & comment 'set the OrderID from the HTML form parmList = parmList + "&COMMENT2=" & comment2 'set the OrderID from the HTML form parmList = parmList + "&EMAIL=" & email Ctx1 = client.CreateContext(serverpfp, 443, 30, "", 0, "", "") curString = client.SubmitTransaction(Ctx1, parmList, Len(parmList)) client.DestroyContext (Ctx1) else curString = "RESULT=0&PNREF=aa&RESPMSG=aa&AUTHCODE=aa" end if ' handle the response 'loop until we're done processing the entire string done = 0 Do while Len(curString) <> 0 'get the next name value pair if InStr(curString,"&") Then varString = Left(curString, InStr(curString , "&" ) -1) else varString = curString end if 'get the name part of the name/value pair name = Left(varString, InStr(varString, "=" ) -1) 'get the value out of the name/value pair value = Right(varString, Len(varString) - (Len(name)+1)) If name = "RESULT" then If value = "0" then myvalue2 = "1" Else myvalue2 = "0" End If Result = myvalue2 Result2 = value End If If name = "PNREF" then Pnref = value End If If name = "RESPMSG" then Respmsg = value End If If name = "Authcode" then Authcode = value End If 'skip over the & if Len(curString) <> Len(varString) Then curString = Right(curString, Len(curString) - (Len(varString)+1)) else curString = "" end if Loop If Result2 = "0" then If Authcode = "" then Authcode = "x" End If desc="OK" End If If Result = "1" then ChargeCard = true else ChargeCard = false end if End Function dim conn, rs set conn = Server.Createobject("adodb.connection") set rs = server.createobject("adodb.recordset") conn.open connstr if session("orderid") = "" then orderid="0" else orderid = session("orderid") end if if orderid = "0" then session("errmsg")="Your shopping cart is empty" response.redirect "http://www.spiritfitness.com/shop/form.asp" else rs.open "select * from orders where id = " & orderid, conn,3,3 if rs.eof then rs.close conn.close session("errmsg")="Order has not been created, can't update, please try again" response.redirect "http://www.spiritfitness.com/shop/abandon.asp" end if if rs("approved") then rs.close conn.close session("errmsg")="Order has been completed and paid for, can't update" response.redirect "http://www.spiritfitness.com/shop/abandon.asp" end if end if email = rs("email") amount = int(rs("ordertotal")+9+.99) rs("ordertotal")=amount 'process credit card and choose value for approved 'approved = chargecard(request("ccnum"),request("expmonth"),request("expyear"),amount) rs("approved") = 1 'approved rs("method") = "C.O.D." rs.update rs.close set rs2 = server.createobject("adodb.recordset") zeroed="" rs.open "select productid,qty from orderdetail where orderid = " &orderid,conn,3,1 do while not rs.eof rs2.open "select * from products where id = " & rs("productid"),conn,3,3 if not isnull(rs2("useinv")) then if rs2("useinv")<>0 then qty = rs2("qty")- rs("qty") rs2("qty")= qty if qty <= 0 then rs2("status")= rs2("onempty") zeroed = zeroed & rs2("code") & "-" & rs2("name") & "
" & chr(13) & chr(10) end if rs2.update end if end if rs2.close rs.movenext loop rs.close conn.close approved=1 if approved then SendMail pnref if zeroed <>"" then msg zeroed end if response.redirect "confirmation.asp?f=0&cod=1" else if zeroed <>"" then msg zeroed end if response.redirect "confirmation.asp?f=1&msg=" & server.urlencode(respmsg) end if %>