📄 buy.asp
字号:
<%@ CODEPAGE = "936" %>
<!--#include file="conn.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%if session("user_name")<>"" then%>
<%=session("user_name")%>的购物车
<%else
response.write "购物车"
end if%>
</title>
<link rel="stylesheet" type="text/css" href="css.css">
<%
if session("user_name")="" then
response.write "<center>"
response.write "您尚未登录或不是本站会员!"
response.write "<br>请登录后再订购本站货物!"
response.end
end if
dim sql,rs
set rs=server.createobject("adodb.recordset")
if request("action")="buy" then
if request("count")="" then
count=1
else
count=request("count")
end if
if request("hw_id")="" then
response.write "没有此货物!"
else
hw_id=request("hw_id")
end if
sql="select * from basket where hw_id='"&hw_id&"' and user_name='"&session("user_name")&"' and basket_check=false"
rs.open sql,conn,3,3
if rs.eof then
rs.addnew
rs("hw_id")=hw_id
rs("user_name")=session("user_name")
rs("basket_count")=count
rs("basket_date")=now()
rs("hw_name")=request("hw_name")
rs("hw_cash")=request("hw_cash")
else
rs("basket_count")=int(rs("basket_count"))+int(count)
end if
rs.update
rs.close
%>
<%end if%>
</head>
<body bgcolor="ffffff" link="#666666" vlink="#666666" alink="#0000FF">
<div align="center">
<table border="1" width="551" cellspacing="0" cellpadding="5" bordercolorlight="#CCCCCC" bordercolordark="#C0C0C0">
<tr>
<td bgcolor="000000" height="1"></td></tr>
<tr>
<td width="98%" bgcolor="f7f7f7" height="18">
<p align="center"><font color="#FF0000">※ 当前您已订购的商品 ※</font></td>
</tr>
<tr>
<td bgcolor="0000000" height="1"></td></tr>
<tr>
<td width="98%" bgcolor="FFFFFF">
<table border="0" width="95%" cellspacing="1" cellpadding="5">
<tr>
<td width="95%" align="center">
<table border="0" width="529" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
<tr bgcolor="#FFFFFF">
<td width="53">
<p align="center">商品编号</td>
<td width="94" align="center">商品名称</td>
<td width="79" align="center">商品单价</td>
<td width="66" align="center">订购数量</td>
<td width="117" align="center">订购时间</td>
<td width="77" align="center">合计</td>
</tr>
<%sql="select * from basket where user_name='"&session("user_name")&"' and basket_check=false"
rs.open sql,conn,3,3
do while not rs.eof%>
<tr bgcolor="#FFFFFF">
<td width="53" align="center"><%=rs("hw_id")%></td>
<td width="94" align="center"><a href="watch.asp?hw_id=<%=rs("hw_id")%>" target="blank"><%=rs("hw_name")%></a></td>
<td width="79" align="center">
<p align="right"><%=rs("hw_cash")%>元</td>
<td width="66" align="center"><%=rs("basket_count")%></td>
<td width="117" align="center"><%=rs("basket_date")%></td>
<td width="77" align="center"><%=rs("hw_cash")*rs("basket_count")%>元</td>
<%totalcash=totalcash+(rs("hw_cash")*rs("basket_count"))%>
</tr>
<%rs.movenext
loop
rs.close
%>
<tr bgcolor="#FFFFFF">
<td colspan="5">
<p align="center"><font color="#FF0000"><b>总计:</b></font></td>
<td width="77" align="right"><font color="#FF0000"><%=totalcash%>元</font></td>
</table>
</td>
</tr><tr><td></td></tr>
<tr><td>
<div align="right"><font color="#FF0000">[</font><a href="index.asp" target="blank"><font color="#FF0000">继续购物</font></a><font color="#FF0000">]</font>
<font color="#FF0000">[</font><a href="cash.asp" target="blank"><font color="#FF0000">收银台</font></a><font color="#FF0000">]</font>
<font color="#FF0000">[</font><a href="clear.asp"><font color="#FF0000">清空购物车</font></a><font color="#FF0000">]</font> <a href='javascript:close()'><font color="#FF0000">[关闭窗口]</font></a></div>
</td></tr>
</table>
</td>
</tr>
</table>
</div>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -