www.gusucode.com > 运动用品商城网站系统源代码程序 > basket.asp

    <!--#include file="conn.asp"-->
<%

host=lcase(request.servervariables("HTTP_HOST"))

if guestorder=0 and Request.Cookies("venshop")("user_name")="" then
response.redirect "login.asp?comurl=basket.asp?"&Request.ServerVariables("QUERY_STRING")
response.end
end if
if Request.Cookies("venshop")("user_name")="" and Request.Cookies("venshop")("guest")="" then
user_name=request.servervariables("remote_addr")&hour(now())&minute(now())&second(now())
user_name=replace(user_name,"-","")
user_name=replace(user_name," ","")
user_name=replace(user_name,":","")
user_name=replace(user_name,".","")
Response.Cookies("venshop")("guest")=user_name
elseif Request.Cookies("venshop")("user_name")<>"" then
user_name=Request.Cookies("venshop")("user_name")
elseif Request.Cookies("venshop")("guest")<>"" then
user_name=Request.Cookies("venshop")("guest")
end if
hw_id=Request("hw_id")
If Not(isNumeric(hw_id)) or hw_id="" or hw_id=0 Then
showerr "e"
End If
tao_id=request("tao_id")
kxa=request("kxa")
kxb=request("kxb")
if request("count")="" or Not(isNumeric(request("count"))) then
count=1
else
count=Cint(request("count"))
end if
set rs=server.createobject("adodb.recordset")
sql="select * from venshop_hw where hw_id="&hw_id&""
rs.open sql,conn,1,1
if tao_id<>"" then
hw_name=rs("hw_name")&"+"&rs("tao_name"&tao_id)
hw_price2=rs("hw_price2")+rs("tao_price"&tao_id)


'**************************************************
hw_price3=rs("hw_price3")+rs("tao_price"&tao_id)
hw_jifen=rs("hw_jifen")
hw_jifen3=rs("hw_jifen3")


else
hw_name=rs("hw_name")



user_type=rs("user_type")
hw_price2=rs("hw_price2")
hw_price3=rs("hw_price3")
hw_jifen=rs("hw_jifen")
hw_jifen3=rs("hw_jifen3")
'********************************************************



tao_id=0
end if
hw_kucun=rs("hw_kucun")
hw_weight=rs("hw_weight")
hw_yunfei=rs("hw_yunfei")
rs.close
set rs=nothing
if hw_kucun=0 then
showerr "e3"
elseif count>hw_kucun then
showerr "e4"
end if
if kxa<>"" then sera=" and kxa='"&kxa&"'"
if kxb<>"" then serb=" and kxb='"&kxb&"'"
set rs=server.CreateObject("adodb.recordset")
sql="select * from venshop_basket where hw_id="&hw_id&" and user_name='"&user_name&"' and tao_id="&tao_id&" and basket_check=0 "&sera&serb&" order by basket_id desc"
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
rs("hw_id")=hw_id
rs("user_name")=user_name
rs("basket_count")=count
rs("basket_date")=now()
rs("hw_name")=hw_name



'*******************************************************************************
'如果会员类型为VIP则为VIP价格和VIP积分,否则为普通会员价格和积分,非注册会员无积分
if Request.Cookies("venshop")("user_type")=2 then
 rs("hw_price")=hw_price3 
 rs("hw_jifen")=hw_jifen3
else 
 rs("hw_price")=hw_price2 
 rs("hw_jifen")=hw_jifen
end if

'********************************************************************************


rs("tao_id")=tao_id
rs("basket_check")=0
if kxa<>"" then rs("kxa")=kxa
if kxb<>"" then rs("kxb")=kxb
rs("hw_weight")=hw_weight
rs("hw_yunfei")=hw_yunfei
else
if rs("basket_count")+count>hw_kucun then
showerr "e4"
else
rs("basket_count")=rs("basket_count")+count
end if
end if
rs.update
rs.close
set rs=nothing
response.redirect "buy.asp"
response.End


%>