%
'connect = "provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("/") & "\order\data\order.mdb"
'connect = "DSN=db118852652"
set cnn = server.createobject("adodb.connection")
cnn.open "DRIVER={SQL Server};SERVER=mssql02.1and1.com;UID=dbo118852652;PWD=plastick;DATABASE=db118852652"
%>
<%
' 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")
%>
Freebirds World Burrito - Web Ordering
|
| Web Ordering |
Freebirds' Mission is to provide
every customer with an awe-inspiring experience combining the highest
possible standards of quality, fresh food, and customer service in a
creative & thought-provoking atmosphere. Please go through this Order Form
carefully to ensure that we prepare and price your Order exactly as you
expect, every time.
|
|
Order Summary
start over
<%if session("order_id") <> "" then%>
Customer: <%=session("cust_name")%>
Store: <%=replace(session("store_name"),"Freebirds @ ","")%>
Order #: <%=session("order_id")%>w3
| QTY - DESCRIPTION |
PRICE |
<%
total = 0
set rs = server.createobject("adodb.recordset")
sql = "SELECT tbl_oline.qty, tbl_oline.price, tbl_oline.label, tbl_oline.id, " & _
"tbl_product.name AS product_name, tbl_product.type, " & _
"tbl_product2.name AS product_name2 " & _
"FROM tbl_oline " & _
"LEFT JOIN tbl_product ON tbl_oline.product_id=tbl_product.id " & _
"LEFT JOIN tbl_oline AS tbl_oline2 ON tbl_oline.id=tbl_oline2.seq_id " & _
"LEFT JOIN tbl_product AS tbl_product2 ON tbl_oline2.product_id=tbl_product2.id " & _
"WHERE tbl_oline.order_id=" & session("order_id") & " " & _
"AND tbl_oline.seq_id=-1"
rs.open sql, cnn, 1, 3
do until rs.eof
total = total + (rs("qty") * rs("price"))
page = rs("type")
if rs("product_name") = "Tortillas" then page = "tortilla"
if left(rs("product_name"),5) = "Chips" or left(rs("product_name"),5) = "2 oun" then page = "chips"
product_name = rs("product_name") & ""
if rs("product_name2") & "" <> "" and product_name <> rs("product_name2") & "" then
product_name = replace(product_name,"Tacos","") & " / " & rs("product_name2")
end if
if left(rs("label"),1)="L" then product_name = "Little Monster " & product_name
%>
<%=rs("qty")%> - "><%=product_name%>
<%if rs("label")<>"" then response.write " (" & rs("label") & ")"%> |
<%=formatcurrency(rs("qty") * rs("price"),2)%> |
<%
rs.movenext
loop
rs.close
set rs = nothing
%>
| Order Total: |
<%=formatcurrency(total,2)%> |
<%if instr(request("script_name"),"menu.asp") > 0 then%>
Please place your drink order at the store when picking up your order.
<%end if%>
<%else%>
Your order summary will appear here once you've started to place your order.
<%end if%>
|
|
|
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.
|
|
<%
cnn.close
set cnn = nothing
%>