<%if Session("huiyuan")="" then
Response.redirect "cart-login.asp" 
Response.end
end if%>
<!--#include file="inc_top.asp" -->
<!--#include file="conn/inc_banner.asp" -->
<%
'收藏变为购买
dim cpid
if request("cpid")<>"" then
cpid=cint(request("cpid"))
	set rs = conn.execute("select * from chanpin where id="&cpid&"")
	if not rs.eof then
		mc=rs("mc")
		userid=rs("userid")
		jg1=rs("jg1")
		jg2=rs("jg2")
		xt=rs("xt")
		rs.close
	end if
	set rs = conn.execute("select * from ls_cart where cpid="&cpid&" and sessionid="&session.sessionid&"")
	if rs.eof then
	conn.execute("Insert into ls_cart(cpid,mc,jg1,jg2,xt,userid,sessionid,sj)values("&cpid&",'"&mc&"',"&jg1&","&jg2&",'"&xt&"',"&userid&","&session.sessionid&",'"&now()&"')")
	set rs1 = conn.execute("select * from ls_userid where userid="&userid&" and sessionid="&session.sessionid&"")
		if rs1.eof then
		conn.execute("Insert into ls_userid(userid,sessionid,sj)values("&userid&","&session.sessionid&",'"&now()&"')")
		else
		conn.execute("Update ls_userid set sj='"&now()&"' where  userid="&userid&" and sessionid="&session.sessionid&"")
		end if
	rs1.close
	set rs1=nothing
	conn.execute("Delete shoucang where huiyuan='"&session("huiyuan")&"' and cp_id="&request("cpid")&"")
	else
	conn.execute("Update ls_cart set sl=sl+1,sj='"&now()&"' where  cpid="&request("cpid")&" and sessionid="&session.sessionid&"")
	conn.execute("Update ls_userid set sj='"&now()&"' where  userid="&userid&" and sessionid="&session.sessionid&"")
	conn.execute("Delete shoucang where huiyuan='"&session("huiyuan")&"' and cp_id="&request("cpid")&"")
	end if
	rs.close
end if
%>

<table width="760"  bgcolor="#ffffff" border="0" align="center" cellpadding="0" cellspacing="0" class="table-zuoyou">
  <tr>
    <td width="170" valign="top" bgcolor="#f3f3f3" class="table-you">
      <table width="170" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td height="32" align="center" valign="bottom" class="table-shang"><img src="image/huiyuan.gif" width="166" height="30"></td>
        </tr>
        <tr> 
          <td height="25" align="center" valign="middle"><img src="image/tp08.gif" width="13" height="13"> 
            <a href="huiyuan-1.asp">我的订单</a></td>
        </tr>
        <tr> 
          <td align="center"><img src="image/xx.gif"></td>
        </tr>
        <tr> 
          <td height="25" align="center" valign="middle"><img src="image/tp08.gif" width="13" height="13"> 
            <a href="huiyuan-2.asp">我的收藏</a></td>
        </tr>
        <tr> 
          <td align="center"><img src="image/xx.gif"></td>
        </tr>
        <tr> 
          <td height="25" align="center" valign="middle"><img src="image/tp08.gif" width="13" height="13"> 
            <a href="huiyuan-3.asp">个人资料</a></td>
        </tr>
        <tr> 
          <td align="center"><img src="image/xx.gif"></td>
        </tr>
        <tr> 
          <td height="25" align="center" valign="middle"><img src="image/tp08.gif" width="13" height="13"> 
            <a href="huiyuan-4.asp">修改密码</a></td>
        </tr>
        <tr> 
          <td align="center"><img src="image/xx.gif"></td>
        </tr>
      </table> 
    </td>
    <td width="590" height="350" align="center" valign="top"><br>
<%
'处理请求
if request("del")="yes" then
         set rs = conn.execute("select huiyuan from shoucang where id="&clng(Request("id"))&"")
		huiyuan=rs("huiyuan")
	    rs.close
    if huiyuan=session("huiyuan") then
      conn.execute("Delete shoucang where id="&clng(Request("id"))&"")
        Response.redirect "huiyuan-2.asp"
    else
		Response.Write("对不起，您不能删除该条信息。如有疑问请与网站管理员联系。")
	 end if
end if
%><table width="98%" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#CCCCCC">
        <tr align="center" bgcolor="#FFFFFF"> 
          <td colspan="5" class="d13"><b> 
            <%response.write session("huiyuan")&"的收藏夹"%>
            </b></td>
        </tr>
        <tr bgcolor="#f1f1f1"> 
          <td class="d13"> <div align="center">商品名称</div></td>
          <td width="75" class="d13"> <div align="center">市场价（元）</div></td>
          <td width="75" class="d13"> <div align="center">会员价（元）</div></td>
          <td width="50" class="d13"> <div align="center">购买</div></td>
          <td width="50" align="center" class="d13"> <div align="center">操作</div></td>
        </tr>
        <%set rs = conn.execute("select * from shoucang where huiyuan='"&session("huiyuan")&"'")		  
		while not rs.eof
	set rs2 = conn.execute("select * from chanpin where id="&rs("cp_id")&" and cang=0")
	if not rs2.eof then
%>
        <tr> 
          <td height="11" bgcolor="#FFFFFF" class="unnamed1" align="center"><a href=product.asp?id=<%=rs2("id")%> target=_blank><%=rs2("mc")%></a></div></td>
          <td width="75" height="11" bgcolor="#FFFFFF" class="unnamed2" align="center"><font color="#FF0000"><b><%=rs2("jg1")%></b></font></td>
          <td width="75" height="11" bgcolor="#FFFFFF" class="unnamed1" align="center"><font color="#FF0000"><b><%=rs2("jg2")%></b></font></td>
          <td width="50" height="11" bgcolor="#FFFFFF" class="unnamed1" align="center"><a href=huiyuan-2.asp?cpid=<%=rs2("id")%>>购买</a></td>
          <td width="50" height="11" bgcolor="#FFFFFF" class="unnamed1" align="center"><a href="?del=yes&id=<%=rs("id")%>">移除</a> 
            </div></td>
        </tr>
        <%	end if
		rs2.close
		rs.movenext
		  wend 
		  rs.close
		  set rs=nothing
		set rs2=nothing 
		  %>
      </table></td>
  </tr>
</table>
<!--#include file="inc_end.asp" -->