<%@ Language=VBScript %>
<%Response.Buffer=true%><%
set conn=Server.CreateObject("ADODB.connection")
conn.open "dsn=pizoozia"
'if Request("submit3")<>"" then
'if request("Email")<>"" and request("First_Name")<>"" then
'set cust_rs=server.CreateObject("adodb.recordset")
'cust_rs.Open "select * from customers where Email='"&request("Email")&"' and First_Name='"&request("First_Name")&"'",conn,3,3
'if cust_rs.EOF and cust_rs.BOF then 'the user does not exist
'Response.Write "yalla bye"
'else
'Response.Redirect("form.asp")
'end if
'set cust_rs=nothing
'end if'then
'end if
'session totalprice=0
' session subtotal=0
'session discsubtotal
'session save
%>
<html>
<head>
<!-- #include file = "menu.asp" -->
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<%
'dim total=0
for each item in Request.Form
if Request.Form (item) <> ("Submit")and Request.Form (item) <> ("Remove")and Request.Form (item) <> ("buy") and Request.Form (item) <> ("update")then
Response.Cookies (item)=Request (item)
Response.Cookies (item).path="/"
Response.Cookies (item).expires=dateadd ("d",30,date())
end if
'total=total+Request.Cookies(cookie)
next
%>
<%
dim conn
dim rs, sql
set rs=Server.CreateObject("ADODB.recordset")
'set rs2=Server.CreateObject("ADODB.recordset")
sql="select * from Items "
' sql="select * from Customers"
rs.Open sql, conn,3
%>
<%
'dim conn2
'set conn2=Server.CreateObject("ADODB.connection")
'conn2.open "dsn=pizoozia"
'set rs2=Server.CreateObject("ADODB.recordset")
'sql="select * from Customers where"
'rs2.Open sql, conn2,3
%>
</head>
<body bgcolor=steelblue>
<h1 align="center"><font color="blue" face ="" style="TEXT-DECORATION: overline"><font style="BACKGROUND-COLOR: #0000cd"><font color="lemonchiffon">your selected
items</font>!</font> </font></h1>
<table border="8" align="center" bgcolor="mediumturquoise" bordercolordark="darkblue">
<tr>
<th style="COLOR: blue">
Item
</th>
<th style="COLOR: blue">
ordered <br>Quantity
</th>
<th style="COLOR: blue">
price<br>for order
</th>
<th style="COLOR: blue">
update<br>the Quantity
</th>
<th style="COLOR: blue">
del<br>the item from basket
</th>
<%
for each cookie in Request.Cookies
if Request.Cookies(cookie) <> ("administrator") then
rs.MoveFirst
rs.Find "Name='"&cookie&"'"
%>
<tr>
<td>
<%
Response.Write cookie
%>
</td>
<%
Response.Write "<FORM action=show_basket.asp method=POST name=form1>"
dim Box
Box=rs("Quantity")
Response.Write "<TD><SELECT name=" & rs("Name") &">"
Response.Write "<OPTION selected value="&Request.Cookies(cookie)&">"&Request.Cookies(cookie)&"</OPTION>"
do while not Box=0
Response.Write "<OPTION>"&Box&"</OPTION>"
Box=Box-1
loop
Response.Write "</SELECT></TD>"
'Response.Write "<tr><td align=right></td>"
Response.Write "<td align=right>"&Request.Cookies(cookie)*rs("Price")&"$</td>"
totalprice=Request.Cookies(cookie)*rs("Price")
Response.Write "<td align=right><INPUT type=submit value=update name=update></td>"
Response.Write "<td align=right><INPUT type=submit value=Remove id=Remove name=Remove></td>"
Response.Write "</FORM>"
for each item in Request.Form
if Request.Form (item) <> ("submit1")and Request.Form (item) <> ("Remove")and Request.Form (item) <> ("buy")and Request.Form (item) <> ("update")then
Response.Cookies (item)=Request.form (item)
Response.Cookies (item).path="/"
Response.Cookies (item).expires=dateadd ("d",30,date())
' Response.Write"<center><cener>"
end if
next
if Request.Form ("Remove")<> "" then
for each item in Request.Form
if Request.Form (item) <> ("Submit")and Request.Form (item) <> ("Remove")and Request.Form (item) <> ("update")then
Response.Write item&" - "&Request.form(item)&"<br>"
Response.Cookies (item)=""
Response.Cookies (item).path="/"
Response.Cookies (item).expires=date()-1
Response.Redirect("show_basket.asp")'refresh
end if
next
%>
</TD>
</tr>
<%
end if
end if
subtotal=totalprice+subtotal
next
if subtotal>100 then
discsubtotal=subtotal-subtotal*10/100
session("discsubtotal")="discsubtotal"
'if Request.Cookies(cookie) <> ("administrator") then
'for each cookie in Request.Cookies
'total=total+Request.Cookies(cookie)
'next
end if
%>
<%
Response.Write"<tr><td>total price</td>"
Response.Write"<td>"&subtotal&"$</td></tr>"
Response.Write"<tr><td>price after discount</td>"
Response.Write"<td>"&discsubtotal&"$</td></tr>"
Response.Write"<tr><td>the mony you saved</td>"
if subtotal>100 then
session("save")=subtotal-discsubtotal
Response.Write"<td>"&session("save")&"$</td></tr>"
end if
%>
</table>
<center> </center> exsisting user<br> enter your email and your name
<A href="form.asp">new
user </a><br>
<br><br>
<table style="WIDTH: 314px; HEIGHT: 90px" cellSpacing="1" cellPadding="1" width="314" border="8" align=left bgcolor="mediumturquoise" bordercolordark="darkblue">
<form id="form1" name="form1" action="form.asp">
<tr>
<td> email<input id="Email" style="WIDTH: 210px; HEIGHT: 22px" size="21" name="Email"></td></tr>
<tr>
<td> name<input id="First_Name" style="WIDTH: 212px; HEIGHT: 22px" size="26" name="First_Name"></td></tr>
<tr>
<td><input id="order!" style="WIDTH: 212px; HEIGHT: 24px" type="submit" size="65" value="order!" name="order!"></td></tr></table>
</FORM>
</body>
</html>