% ' find out if the ordering system is enabled or disabled Set rs = CreateObject("adodb.recordset") sql = "SELECT * FROM tbl_status" rs.open sql, cnn, 0, 1 if rs.eof then status = "0" else status = abs(cint(rs("active"))) end if rs.close set rs = nothing if status & "" = "1" then Set rs = CreateObject("adodb.recordset") sql = "SELECT count(*) FROM tbl_store WHERE active=1" rs.open sql, cnn, 0, 1 if rs(0) = 0 then status = "0" rs.close set rs = nothing end if if status & "" = "0" then response.redirect "/order_status.asp" end if function striptonum(thestring) temp = "" for i = 1 to len(thestring) if isnumeric(mid(thestring,i,1)) then temp = temp & mid(thestring,i,1) end if next striptonum = temp end function session.timeout = 60 phone = request("phone") phone = striptonum(phone) if request("action") = "continue..." then if request("email") = "" or request("name") = "" or request("phone") = "" or request("store_id") = "" then msg = "Please enter your email address, full name, phone number " & _ " and store before trying to continue." elseif len(phone) <> 7 and len(phone) <> 10 then msg = "Please enter a seven or ten digit phone number before trying to continue." elseif instr(request("email"),"@") = 0 then msg = "Please enter a valid email address before trying to continue." else set rs = server.createobject("adodb.recordset") sql = "SELECT * FROM tbl_cust WHERE email='" & request("email") & "'" rs.open sql, cnn, 1, 3 if rs.eof then rs.addnew rs("email") = request("email") rs("name") = request("name") rs("phone") = request("phone") rs("phone_ext") = request("phone_ext") rs("store_id") = request("store_id") rs.update rs.close ' reget the record, in case it was an addnew, to get the customer number rs.open sql, cnn, 1, 3 cust_id = rs("id") session("cust_id") = cust_id session("cust_name") = rs("name") session("cust_email") = rs("email") session("cust_phone") = request("phone") & " ext " & request("phone_ext") rs.close ' create an order record order_date = now() cnn.execute "INSERT INTO tbl_order (cust_id, store_id, order_date) " & _ "VALUES (" & cust_id & ", " & _ request("store_id") & ", " & _ "'" & order_date & "')" ' get order id sql = "SELECT tbl_order.*, tbl_store.name, tbl_store.phone, tbl_store.email " & _ "FROM tbl_order " & _ "LEFT JOIN tbl_store ON tbl_order.store_id=tbl_store.id " & _ "WHERE order_date='" & order_date & "' " & _ "AND cust_id=" & cust_id & " " & _ "AND store_id=" & request("store_id") & " " rs.open sql, cnn, 1, 3 session("store_name") = rs("name") session("store_phone") = rs("phone") session("store_email") = rs("email") session("store_id") = rs("store_id") session("order_id") = rs("id") rs.close set rs = nothing cnn.close set cnn = nothing ' save the cust id as a cookie (if they are a new user the cart items will time out if we don't do this) Response.Cookies("cust_id") = session("cust_id") Response.Cookies("cust_id").Expires = monthname(month(date)) & " " & day(date) & ", " & year(date)+1 Response.Cookies("cust_id").Domain = "freebirds.com" Response.Cookies("cust_id").Path = "/" Response.Cookies("cust_id").Secure = FALSE response.redirect "menu.asp" end if end if cust_id = request.cookies("cust_id") if cust_id <> "" then set rs = server.createobject("adodb.recordset") sql = "SELECT * FROM tbl_cust WHERE id=" & cust_id rs.open sql, cnn, 1, 3 email = rs("email") name = rs("name") phone = rs("phone") phone_ext = rs("phone_ext") rs.close set rs= nothing end if if request("email") <> "" then email = request("email") if request("name") <> "" then name = request("name") if request("phone") <> "" then phone = request("phone") if request("phone_ext") <> "" then phone_ext = request("phone_ext") %> Welcome!
<%if msg = "" then%> Get started now by filling out the form below. <%else%> <%=msg%> <%end if%>
Sorry, as of July 14, 2003, Freebirds can no longer accept checks.