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

📄 shoucang.asp

📁 创建和运行动态、交互的Web服务器应用程序
💻 ASP
字号:
<!--#include file="conn.asp"-->
<%
if request.cookies("bookshop")("username")="" then
response.write "<script language=javascript>alert('对不起,您还没有登陆!');window.close()</script>"
response.End
end if

dim bookid,username,action,bk,index,i

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")
       response.Redirect "myuser.asp?action=shoucang"

       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('对不起,此商品已存在于您的收藏架中,不可以重复添加!');window.location.reload('myuser.asp?action=shoucang')</script>"
           rs.close
       set rs=nothing
    else
       '//判断收藏数
       if rs.recordcount=10 then
          response.write "<script language=javascript>alert('对不起,您的商品收藏已超过10个!');window.location.reload('myuser.asp?action=shoucang')</script>"
       else
       '//添加收藏
       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
       response.Redirect "myuser.asp?action=shoucang"
           rs.close
       set rs=nothing
   end if
        case "ord_cart"
        
       '//收藏,判断是否存在
       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('对不起,此商品已存在于您的收藏架中,不可以重复添加!');window.location.reload('show_cart.asp')</script>"
           rs.close
       set rs=nothing
    else
       '//判断收藏数
       if rs.recordcount=10 then
          response.write "<script language=javascript>alert('对不起,您的商品收藏已超过10个!');window.location.reload('show_cart.asp')</script>"
       else
       '//添加收藏
      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
       
          bk     = Session("mycart")
          index  = request("index")

          for i=0 to 4
	      bk(index,i)="0"
          next

          Session("mycart") =bk
          response.redirect"show_cart.asp"
       end if
           rs.close
       set rs=nothing
     end if
end select%>

⌨️ 快捷键说明

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