⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buy.asp

📁 自做的购物网站
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="css.asp"-->
<title><%if session("user_name")<>"" then%>
<%=session("user_name")%>的购物车
<%else
response.write "购物车"
end if%>
</title>
<%
if session("user_name")="" then
	response.write  "<br>"
    response.write  "1.你尚未登录!请登录后再订购本站商品!"
    response.write "<br>2.第一次来本站,请先注册会员(免费)!"
	response.write  "<br>"
	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
%>
</b></FONT>
<%end if%>
<br>
<table border="0" width="400" cellspacing="0" cellpadding="0">
  <tr> 
    <td height="18"><TABLE style="BORDER-COLLAPSE: collapse" borderColor=#525e6b cellSpacing=0 
      cellPadding=0 width="100%" align=center border=1>
        <TBODY>
          <TR> 
            <TD width="100%"> <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 
            cellSpacing=0 cellPadding=0 width="100%" border=0>
                <TBODY>
                  <TR> 
                    <TD vAlign=top width=300> <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 
                  cellSpacing=0 cellPadding=0 width="100%" 
                  background="images/pics2/infobg.gif" 
                  border=0>
                        <TBODY>
                          <TR> 
                            <TD width=45><IMG height=32 
                        src="images/pics2/icon.gif" 
                        width=40 border=0></TD>
                            <TD vAlign=middle><font color="#FFFFFF">你已选购的商品如下 
                              </font></TD>
                            <TD width=43> <P align=right><IMG height=32 
                        src="images/pics2/edge(1).gif" 
                        width=43 border=0></P></TD>
                          </TR>
                        </TBODY>
                      </TABLE></TD>
                    <TD align=right 
                background="images/pics2/rightbg.gif"> <IMG 
                  alt=- 
                  src="images/pics2/space1.gif" width="3" height="32"></TD>
                  </TR>
                </TBODY>
              </TABLE></TD>
          </TR>
          <TR> 
            <TD width="100%"> <TABLE id=AutoNumber6 style="BORDER-COLLAPSE: collapse" 
            borderColor=#111111 cellSpacing=0 cellPadding=2 width="100%" 
            border=0>
                <TBODY>
                  <TR> 
                    <TD width="100%"><br> <table width="94%" border="0" align="center" cellpadding="0" cellspacing="1" background="IMAGES/pics2/infobg.gif">
                        <tr background="IMAGES/pics2/infobg.gif"> 
                          <td width="100" height="25"> <div align="center"><font color="#FFFFFF">商品名称</font></div></td>
                          <td width="51"> <div align="center"><font color="#FFFFFF">商品单价</font></div></td>
                          <td width="36"> <div align="center"><font color="#FFFFFF">数量</font></div></td>
                          <td width="62"> <div align="center"><font color="#FFFFFF">订购时间</font></div></td>
                          <td width="51"> <div align="center"><font color="#FFFFFF">合计</font></div></td>
                          <td width="61"> <div align="center"><font color="#FFFFFF">取消</font></div></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> 
                          <td width="100" height="25" bgcolor="#FFFFFF"> <div align="center"><font color="#FF0000"><%=rs("hw_name")%></font></div></td>
                          <td width="51" height="25" bgcolor="#FFFFFF"> <div align="center"> 
                              <%=rs("hw_cash")%> 元</div></td>
                          <td width="36" height="25" bgcolor="#FFFFFF"> <div align="center"><%=rs("basket_count")%> 
                            </div></td>
                          <td width="62" height="25" bgcolor="#FFFFFF"> <div align="center"><%=rs("basket_date")%> 
                            </div></td>
                          <%a=0%>
                          <td width="51" height="25" bgcolor="#FFFFFF"> <div align="center"> 
                              <%=rs("hw_cash")*rs("basket_count")%> 元 </div></td>
                          <td width="61" height="25" bgcolor="#FFFFFF"> <div align="center"><a href="clear.asp?basket_id=<%=rs("basket_id")%>"><u><img src="IMAGES/pics2/s_button000-2.gif" width="45" height="20" border="0"></u></a></div></td>
                          <%totalcash=totalcash+(rs("hw_cash")*rs("basket_count"))%>
                        </tr>
                        <%rs.movenext
              loop
              rs.close
              %>
                        <tr> 
                          <td height="25" colspan="4" bgcolor="#FFFFFF"> <div align="center">总计:</div></td>
                          <td height="25" bgcolor="#FFFFFF" colspan="2"> <div align="center"><%=totalcash%> 
                              元</div></td>
                      </table>
                      <br> </TD>
                  </TR>
                </TBODY>
              </TABLE></TD>
          </TR>
          <TR> 
            <TD width="100%" height="20" bgColor=#3e3e4b>&nbsp; </TD>
          </TR>
        </TBODY>
      </TABLE></td>
  </tr>
  <tr> 
    <td valign="top"></td>
  </tr>
  <tr> 
    <td height="30"><table width="83%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="33%"><a href="buy.asp"><img src="IMAGES/pics/lookbcar.gif" width="100" height="20" border="0"></a></td>
          <td width="33%"><a href="clear.asp"><img src="IMAGES/pics/relbcar.gif" width="100" height="20" border="0"></a></td>
          <td width="33%"><a href="cash.asp"><img src="IMAGES/pics/gobuy.gif" width="100" height="20" border="0"></a></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td></td>
  </tr>
</table>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -