<!--#include file="conn.asp"-->
<!--#include file="fuction.asp" -->
<%
dim shopid,username,action
action=nosql(request.QueryString("action"))
if trim(session("username"))="" then 
username=nosql(session("tmp_usersessionid"))
else
username=nosql(trim(session("username")))
end if
shopid=nosql(request.QueryString("id"))
'//删除收藏
select case action
case "del"
if Not isChkInteger(request.QueryString("actionid")) then
	%>
	<script language=javascript>
		alert("参数错误！");
		window.close();
	</script>
	<%
	response.end
end if

conn.execute "delete from shop_action where actionid="&nosql(request.QueryString("actionid"))
if request.QueryString("ll")=22 then
response.redirect "myuser.asp?action=shoucang"
else
response.redirect "gouwu.asp?action=show"
end if
response.End
case "add"
'//商品，判断是否存在
if not isChkInteger(shopid) then
%>
<script language=javascript>
		alert("参数错误！");
		window.close();
	</script>
	<%
response.end
end if
set rs_s=server.CreateObject("adodb.recordset")
rs_s.open "select * from wygkcn_shop where shopid="&shopid,conn,1,1
if trim(session("username"))="" then
  danjia=rs_s("shichangjia")
else
if session("reglx")=1 then 
	danjia=rs_s("huiyuanjia")
elseif session("reglx")=2 then 
	danjia=rs_s("vipjia")
elseif session("reglx")=3 then 
	danjia=rs_s("pifajia")
else
	danjia=rs_s("shichangjia")
end if
end if
kucun=rs_s("kucun")
shopname=rs_s("shopname")
rs_s.close
set rs_s=nothing
if kucun<=0 then
response.write "<script language=javascript>alert('The product you selected“"&shopname&"”is out of stock right now, please go back to choose other products.');window.history.go(-1);</script>"
response.end
end if
  set rs=server.CreateObject("adodb.recordset")
  rs.open "select shopid,username,shopcount,zonger from shop_action where username='"&checkFFSQLStr(username)&"' and shopid="&shopid&" and zhuangtai=7",conn,1,3
      if rs.recordcount=1 then
         if kucun<(rs("shopcount")+1) then
         response.write "<script    language=javascript>alert('The product you selected“"&shopname&"”is out of stock right now, please go back to choose other products.');window.history.go(-1);</script>"
         response.end
         end if
        rs("zonger")=(rs("shopcount")+1)*danjia
        rs("shopcount")=rs("shopcount")+1
        rs.update
        rs.close
        set rs=nothing
        response.Redirect "gouwu.asp?action=show"
       else
       '//添加购物
         rs.close
         set rs=server.CreateObject("adodb.recordset")
         rs.open "select shopid,username,zhuangtai,zonger,shopcount,actiondate from shop_action",conn,1,3
         rs.addnew
         rs("shopid")=shopid
         rs("actiondate")=now()
         rs("username")=username
         rs("zhuangtai")=7
         rs("shopcount")=1
         rs("zonger")=danjia
         rs.update
         rs.close
         set rs=nothing
         response.Redirect "gouwu.asp?action=show"
        end if
case "show"
'//////////////////
%>
<!--#include file="webconfig.asp"-->
<!--#include file="fuction.asp"-->
<style type="text/css">
<!--
.style1 {	color: #FF6600;
	font-weight: bold;
}
-->
</style>
<!--#include file="webtop.asp"-->  
<table width="1000" align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="6" colspan="3"></td>
  </tr>
  <tr>
    <td width="20"></td>
    <td valign="bottom"><img src="<%=weburl%>images/arrow01.gif" width="11" height="11" /> Your present position: <a href="<%=weburl%>"><%=webname%></a> ->
 Cart</td>
    <td valign="bottom"><div align="right"><!--注：购物数量达到<%=pifa_s%>件或金额累积到<%=pifa_e%>可以享受更优惠价格! --> </div> 
       
    </td>
  </tr>
  <tr>
    <td height="6" colspan="3"></td>
  </tr>
</table>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
		<td width="205" valign="top"><!--#include file="index_login01.asp"--></td>
          <td awidth="795"  valign="top"><table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td><img src="<%=weburl%>images/gouwu01.jpg" width="780" height="33"></td>
              </tr>
              <tr>
                <td height="8"></td>
              </tr>
            </table>
            <%
set rs=server.CreateObject("adodb.recordset")
rs.open "select shop_action.actionid,shop_action.shopid,shop_action.shopcount,shop_action.zonger,wygkcn_shop.shopname,wygkcn_shop.shichangjia,wygkcn_shop.huiyuanjia,wygkcn_shop.vipjia,wygkcn_shop.pifajia,wygkcn_shop.cjname from wygkcn_shop inner join  shop_action on wygkcn_shop.shopid=shop_action.shopid where shop_action.username='"&username&"' and shop_action.zhuangtai=7",conn,1,1 
if session("username")="" then
			if gouwu<>"1" then
   if session("username")="" then
   response.Write "<script language='javascript'>alert('Sorry! You can not check it because you have not log in!');window.location.href='login.asp';</script>"
   response.End
   end if
   end if%>           
            <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
              <form name="userlogin" method="post" action="checkuserlogin.asp?action=1"></form>
             <form name="userlogin" method="post" action="checkuserlogin.asp?action=3"> <tr>
                <td height="25" bgcolor="#f1f1f1"><span class="pad">&nbsp;Username：
                    <input name="username" type="text" class="wenbenkuang" id="username" size="22">
E-mail： 
                          <input name="useremail" type="text" class="wenbenkuang" id="useremail" value="@" size="22">
Password： 
                          <input name="userpassword" type="password" class="wenbenkuang" id="userpassword" size="22">
                          <input name="Submit4" type="submit" class="go-wenbenkuang" value="Be Our Member" onClick="return checkuserinfo();">
                          <%
set rsr=server.CreateObject("adodb.recordset")
rsr.open "select shop_action.actionid,shop_action.shopid,shop_action.shopcount,shop_action.zonger,wygkcn_shop.shopname,wygkcn_shop.shichangjia,wygkcn_shop.huiyuanjia,wygkcn_shop.vipjia,wygkcn_shop.cjname from wygkcn_shop inner join  shop_action on wygkcn_shop.shopid=shop_action.shopid where shop_action.username='"&username&"' and shop_action.zhuangtai=7",conn,1,1 
%>
                          <%
do while not rsr.eof%>
                          <input name=shopid type=hidden checked value=<%=rsr("shopid")%> >
                          <%rsr.movenext
loop
%>
</span></td>
              </tr>
               <tr>
                 <td height="25" bgcolor="#f1f1f1">&nbsp;<span class="pad"></span><span class="pad">Register Now!</span>You can save more! </td>
               </tr>
             </form>
            </table>
            <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">
              
              <tr>
                <td height="8"></td>
              </tr>
            </table>
            <%end if%>            <table width=800 border=0 align=center cellpadding=0 cellspacing=0>
              <form name='form1' method='post' action=xgsl.asp>
              <tr>
    <td height="1" background="img/xian_001.gif"></td>
	<td height="1" background="img/xian_001.gif"></td>
	<td height="1" background="img/xian_001.gif"></td>
	<td height="1" background="img/xian_001.gif"></td>
	<td height="1" background="img/xian_001.gif"></td>
  </tr>
               
                <tr bgcolor="#FFFFFF"> 
                  <td height=18 colspan=6> <div align=center>
                      <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
                        <tr bgcolor="#cccccc">
                          <td width="41%" height="24" bgcolor="#cccccc"><strong>&nbsp; Product </strong> </td>
                          <td width="17%" align="center"><strong>
                            <%if session("reglx")=2 then %>
                      <strong><%=jiagename3%></strong>
                      <%elseif session("reglx")=3 then %>
                      <strong><%=jiagename4%></strong>
					    <%elseif session("reglx")=1 then %>
                      <strong><%=jiagename2%></strong>
                      <%else%>
                      <strong><%=jiagename1%></strong>
                      <%end if%></strong></td>
                          <td width="19%" align="center"><strong>Qty</strong></td>
                          <td width="15%" align="center"><strong>Total Price</strong></td>
                          <td width="8%" align="center"><strong>Remove</strong></td>
                        </tr><%shuliang=rs.recordcount
jianshu=0
zongji=0
do while not rs.eof%>
                        <tr bgcolor="#FFFFFF">
                          <td height="24" bgcolor="#FFFFFF">&nbsp; <a href=list.asp?id=<%=rs("shopid")%> target=_blank><font color="#5B892E">(<%=rs("shopid")%>)<%=rs("shopname")%></font></a>
                          <input name=shopid type=hidden value="<%=rs("shopid")%>" >                            <input name=actionid type=hidden value="<%=rs("actionid")%>" ></td>
                          <td align="center"> <%
if session("reglx")=2 then 
	response.write rs("vipjia")
elseif  session("reglx")=3 then 
	response.write rs("pifajia")
elseif session("reglx")=1 then
	response.write rs("huiyuanjia")
else
	response.write rs("shichangjia")
end if%></td>
                          <td align="center">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="41%"><div align="center"><input class="wenbenkuang" name=shopcount value="<%=rs("shopcount")%>" size=3></div></td>
                                <td width="59%"><input name="imageField2" type="image" src="images/xgsl.gif" width="80" height="18" border="0" onFocus="this.blur()" onClick="this.form.action='xgsl.asp';this.form.submit()"></td>
                              </tr>
                            </table></td>
                          <td align="center"><font color=#FF3300><%=formatnumber(round(rs("zonger"),1),1)%></font></td>
                          <td align="center"><a href=gouwu.asp?action=del&actionid=<%=rs("actionid")%>><img src=img/trash.gif width=15 height=17 border=0></a></td>
                        </tr>
                <%
jianshu=jianshu+rs("shopcount")
zongji=zongji+rs("zonger")
rs.movenext
loop
rs.close
set rs=nothing%>
                    </table><br>
                      <input name="imageField" type="image" src="images/jxgw.gif" width="160" height="28" border="0"  onFocus="this.blur()" onClick="this.form.action='index.asp';this.form.submit()">
                      
                      <input name="imageField22" type="image" src="images/qxdd.gif" width="100" height="28" border="0" onFocus="this.blur()" onClick="this.form.action='qkgwc.asp';this.form.submit()">
                      <%if session("username")="" then%>
                      <input name="imageField222" type="image" src="images/next.gif" width="80" height="28" border="0" onFocus="this.blur()" onClick="this.form.action='wygkcn01.asp';this.form.submit()"><br>
                      <%else%>                      <input name="imageField222" type="image" src="images/next.gif" width="80" height="28" border="0" onFocus="this.blur()" onClick="this.form.action='wygkcn02.asp';this.form.submit()"><br>
					  <%end if%><table width="85%" border="0" cellspacing="0" cellpadding="0">
                        

                        
                        
                        <tr>
                          <td height="25">· The Cart will be closed after 30 minutes!</td>
                        </tr>
                      </table>
                    </div></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height=18 colspan=6><%set snsn=server.CreateObject("adodb.recordset")
	snsn.open "select * from shop_action_jp where username='"&session("username")&"' and zhuangtai=7",conn,1,1
	if snsn.recordcount>0 then%><br><table width="96%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
                
                  <tr align="center" bgcolor="f1f1f1">
                    <td height="22">Gift</td>
                    <td height="22" align="center">Score</td>
                    <td height="22" align="center">Delete</td>
                  </tr>
                 
                  <%
	while not snsn.eof%>
                  <tr bgcolor="#FFFFFF">
                    <td height="22">
                      <div align="center">
                        <%
	set snsn1=server.CreateObject("adodb.recordset")
	snsn1.open "select * from shop_jiangpin where shopid="&snsn("shopid"),conn,1,1
	if snsn1.recordcount=1 then
	response.write "<a href='listjp.asp?id="&snsn("shopid")&"' target=_blank>"&snsn1("shopname")&"</a>"
	end if
	snsn1.close
	set snsn1=nothing%>
                    </div></td>
                    <td height="22" align="center"><%=snsn("jifen")%></td>
                    <td height="22" align="center"><a href="jifen.asp?actionid=<%=snsn("actionid")%>&action=del&ll=22"><img src=img/trash.gif width=15 height=17 border=0></a></td>
                  </tr>
                  <%
	snsn.movenext
	wend%>
                </table>
                  <%end if
snsn.close
set snsn=nothing%></td>
                </tr>
              </form>
            </table>
            <br> 
            <div align="center"> 
              
             
          </div>          </td>
        </tr>
</table>
<%
end select%>
<!--#include file="gouwuliucheng.asp"-->
<!--#include file="copyright.asp"-->
</body>
</html>

