
<!--#include file="Include/Iheeo_Conn.asp"-->
<!--#include file="Include/Iheeo_config.asp"-->
<html><head><title><%=webname%>--我的收藏架</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
<%
if request.Cookies("bjx")("username")="" then
response.write "<script language=javascript>alert('对不起，您还没有登陆！');window.close();</script>"
response.End
end if
dim bookid,username,action
action=request.QueryString("action")
username=trim(request.Cookies("bjx")("username"))
bookid=request.QueryString("id")

if InStr(action,"'")>0 then
response.write"<script>alert(""非法访问!"");window.close();</script>"
response.end
end if

if bookid<>"" then
if not isnumeric(bookid) then 
response.write"<script>alert(""非法访问!"");window.close();</script>"
response.end
else
if not isinteger(bookid) then
response.write"<script>alert(""非法访问!"");window.close();</script>"
end if
end if
end if

'//删除收藏
select case action
case "del"
conn.execute "delete from BJX_action where actionid="&request.QueryString("actionid")
if request.QueryString("ll")=1 then
response.redirect "user.asp?action=shoucang"
else
response.redirect "shoucang.asp?action=show"
end if
response.End
case "add"
'//收藏，判断是否存在
set rs=server.CreateObject("adodb.recordset")
rs.open "select bookid,username from BJX_action where username='"&username&"' and bookid="&bookid&" and zhuangtai=6",conn,1,1
if not rs.eof and not rs.bof then
response.write "<script language=javascript>alert('对不起，此商品已存在于您的收藏架中，不可以重复添加！');window.location.href='shoucang.asp?action=show';</script>"
response.end
rs.close
set rs=nothing
else
'//判断收藏数
if rs.recordcount=10 then
response.write "<script language=javascript>alert('对不起，您最多只能收藏10件商品！');window.location.href='shoucang.asp?action=show';</script>"
response.end
else
rs.close
set rs=nothing
'//添加收藏
set rs=server.CreateObject("adodb.recordset")
rs.open "select bookid,username,zhuangtai,zonger from BJX_action",conn,1,3
rs.addnew
rs("bookid")=bookid
rs("username")=username
rs("zhuangtai")=6
rs("zonger")=0
rs.update
end if
rs.close
response.Redirect "shoucang.asp?action=show"
set rs=nothing
end if
case "show"
'//////////////////
response.write "<table width=96% border=0 align=center cellpadding=2 cellspacing=2><tr><td width=60% >"
response.write "</td><td width=40% valign=baseline><div align=right>您最多只能收藏十种商品</div></td></tr></table>"
set rs=server.CreateObject("adodb.recordset")
rs.open "select bjx_action.actionid,bjx_action.bookid,BJX_goods.bookname,BJX_goods.shichangjia,BJX_goods.huiyuanjia,BJX_goods.vipjia,BJX_goods.dazhe from BJX_goods inner join  bjx_action on BJX_goods.bookid=bjx_action.bookid where bjx_action.username='"&request.Cookies("bjx")("username")&"' and bjx_action.zhuangtai=6",conn,1,1 
%>
<table width=96% border=0 align=center cellpadding=2 cellspacing=1 bgcolor=#cccccc>
<form name='form1' method='post' action="sctogw.asp">
<%
response.write "<tr align=center><td width=8% bgcolor=#f1f1f1>选择</td>"
response.Write "<td width=42% bgcolor=#f1f1f1>商品名称</td>"
response.Write "<td width=14% bgcolor=#f1f1f1>市场价</td>"
response.Write "<td width=14% bgcolor=#f1f1f1>会员价</td>"
response.Write "<td width=14% bgcolor=#f1f1f1>VIP 价</td>"
response.Write "<td width=8% bgcolor=#f1f1f1>删 除</td></tr>"
do while not rs.eof
response.write "<tr><td bgcolor=#ffffff><div align=center><input name=bookid type=checkbox checked value="&rs("bookid")&" ></div></td>"
response.write "<td bgcolor=#ffffff STYLE='PADDING-LEFT: 5px'><div align=left><a href=goodsview.asp?bjxGid="&rs("bookid")&" >"&rs("bookname")&"</a></div></td>"		  
response.write "<td bgcolor=#ffffff><div align=center>"&formatnumber(rs("shichangjia"),2)&"元</div></td>"	
response.write "<td bgcolor=#ffffff><div align=center><font color=#dd6600>"&formatnumber(rs("huiyuanjia"),2)&"元</font></div></td>"
response.write "<td bgcolor=#ffffff><div align=center><font color=#FF3300>"&formatnumber(rs("vipjia"),2)&"元</font></div></td>"
response.write "<td bgcolor=#ffffff><div align=center>"
response.Write "<a href=shoucang.asp?action=del&actionid="&rs("actionid")&">"
response.Write "<img src=images/trash.gif border=0></a></div></td></tr>"
rs.movenext
loop
rs.close
set rs=nothing
%>
<tr>
<td height=36 colspan=6 bgcolor=#ffffff align=center> 
<input class="go-wenbenkuang" onFocus="this.blur()" type="submit" name="submit" value=" 去收银台 ">
<input class="go-wenbenkuang" onFocus="this.blur()" onclick="javascript:window.close();" type=reset name="button" value=" 继续购物 ">
</td></tr></form></table>
<%end select%>
</body>
</html>
