<!--#include file="conn.asp"-->
<%
if guestorder=0 and Request.Cookies("WrzcNethtml")("user_name")="" then
response.redirect "login.asp?comurl=basket.asp?"&Request.ServerVariables("QUERY_STRING")
response.end
end if
if Request.Cookies("WrzcNethtml")("user_name")="" and Request.Cookies("WrzcNethtml")("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("WrzcNethtml")("guest")=user_name
elseif Request.Cookies("WrzcNethtml")("user_name")<>"" then
user_name=Request.Cookies("WrzcNethtml")("user_name")
elseif Request.Cookies("WrzcNethtml")("guest")<>"" then
user_name=Request.Cookies("WrzcNethtml")("guest")
end if
hw_id=Request("hw_id")
chkid(hw_id)
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
if count<=0 then count=1
set rs=server.createobject("adodb.recordset")
sql="select * from WrzcNethtml_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_jifen=rs("hw_jifen")
else
hw_name=rs("hw_name")
hw_price2=rs("hw_price2")
hw_jifen=rs("hw_jifen")
tao_id=0
end if
hw_kucun=rs("hw_kucun")
hw_weight=rs("hw_weight")
hw_yunfei=rs("hw_yunfei")
hw_price0=rs("hw_price0")
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 WrzcNethtml_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
rs("hw_price")=hw_price2
rs("hw_jifen")=hw_jifen
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
rs("hw_price0")=hw_price0
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
%>