<!--#include file="conn.asp"-->
<!--#include file="webconfig.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">
<style>
td{font-size:9pt;line-height:120%;color:#353535} 
body{font-size:9pt;line-height:120%} 

a:link          { color: #000000; text-decoration: none }
a:visited       { color: #000000; text-decoration: none }
a:active        { color: #000000; text-decoration: none }
a:hover         { color: #336699; text-decoration: none; position: relative; right: 0px; top: 1px }
</style>
</head>
<body leftmargin="3" topmargin="5" marginwidth="0" marginheight="0">
<%
if request.cookies("bookshop")("username")="" then
response.write "<script language=javascript>alert('对不起，您还没有登陆！');history.go(-1);</script>"
response.End
end if
dim bookid,username,action
action=request.QueryString("action")
username=trim(request.cookies("bookshop")("username"))
bookid=request.QueryString("id")
'//删除收藏
select case action
case "del"
conn.execute "delete from shop_action where actionid="&request.QueryString("actionid")
if request.QueryString("ll")=22 then
response.redirect "myuser.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 shop_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('对不起，此商品已存在于您的收藏架中，不可以重复添加！');history.go(-1);</script>"
response.end
rs.close
set rs=nothing
else
'//判断收藏数
if rs.recordcount=10 then
response.write "<script language=javascript>alert('对不起，您的商品收藏已超过10个！');history.go(-1);</script>"
response.end
else
rs.close
set rs=nothing
'//添加收藏
set rs=server.CreateObject("adodb.recordset")
rs.open "select bookid,username,zhuangtai,zonger from shop_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"
'///////////////////////////////////////////%>
<!--#include file="subuser.asp"-->
<%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>"
shoucang()
end select%>
</body>
</html>
