📄 foodsend.asp
字号:
<!--#include file="conn.asp"-->
<!-- #include file="shopconn.asp" -->
<!--#include file="../tools.asp"-->
<%
if Request.Cookies("NC")="" or Request.Cookies("NC")="访客" then
Response.Write("对不起,您不是社区用户,请先注册!")
Response.End
else
dim foodid,gnum,gtext,guser
dim username,foodname,fooddate,foodpic,foodsx,foodvalue,foodmoney,foodtext,foodnum,foodlast,sentname,foodacc,foodsent,senttext
dim brs,tmpsx,foodlasted,show
%><HTML><HEAD><title>超级市场 → 使用商品</title><%call shophead()%><TABLE cellpadding="0" cellspacing="0" width=100%>
<TR>
<TD align="center"><%
foodid=request("foodid")
if foodid="" then
response.write "<script>alert('请从正当渠道进来,谢谢!');history.go(-1);</script>"
response.end
else
set rs=server.createobject("adodb.recordset")
sql="select * from [foodbuy] where id="&foodid
rs.open sql,connshop,1,3
username=rs("userid")
foodname=rs("foodname")
fooddate=rs("fooddate")
foodpic=rs("foodpic")
foodsx=rs("foodsx")
select case foodsx
case "JYZ"
tmpsx="经验"
case "ML"
tmpsx="魅力"
case "FTS"
tmpsx="发帖数"
end select
foodvalue=rs("foodvalue")
foodmoney=rs("foodmoney")
foodtext=rs("foodtext")
foodnum=rs("foodnum")
foodlast=rs("foodlast")
sentname=rs("sentname")
foodacc=rs("foodacc")
foodsent=rs("foodsent")
senttext=rs("senttext")
show=rs("show")
foodlasted=datediff("d",cdate(fooddate),now)
if rs.eof and rs.bof then
response.write "<script>alert('该商品不存在或者该商品不属于您!');history.go(-1);</script>"
response.end
end if
end if
guser=request("guser")
if guser=username then
response.write "<script>alert('系统不允许您将礼物送给自己!');history.go(-1);</script>"
response.end
end if
set brs=server.createobject("adodb.recordset")
sql="select * from [HY] where NC='"&guser&"'"
brs.open sql,conn,1,3
if brs.eof or brs.bof then
response.write "<script>alert('此人还没有注册为会员!');history.go(-1);</script>"
response.end
end if
gnum=request("gnum")
if gnum="" or gnum<=0 or cint(gnum)>cint(foodnum) then
response.write "<script>alert('请正确输入您要使用的数量!');history.go(-1);</script>"
response.end
end if
gtext=request("gtext")
if gtext="" then
response.write "<script>alert('您忘了说祝福语了!');history.go(-1);</script>"
response.end
end if
if cint(gnum)=cint(foodnum) then
rs("userid")=guser
rs("sentname")=username
rs("senttext")=gtext
rs("foodsent")=true
rs("foodacc")=true
rs.update
rs.close
set rs=nothing
else
rs("foodnum")=foodnum-gnum
rs.update
rs.addnew
rs("userid")=guser
rs("foodname")=foodname
rs("foodpic")=foodpic
rs("fooddate")=fooddate
rs("foodsx")=foodsx
rs("foodvalue")=foodvalue
rs("foodtext")=foodtext
rs("foodmoney")=foodmoney
rs("sentname")=sentname
rs("foodacc")=true
rs("senttext")=gtext
rs("foodsent")=true
rs("foodlast")=foodlast
rs("foodnum")=gnum
rs("show")=show
rs.update
rs.close
set rs=nothing
end if
set rs2=server.createobject("adodb.recordset")
faceshow="face_"&cint(show+2)
sql="select "&faceshow&" from [user] where NC='"&username&"'"
rs2.open sql,connshop,1,3
if not Rs2.eof then
rs2(0)="userface/face.gif"
rs2.update
rs2.close
set rs2=nothing
end if
dim message,sendid
set rs1=server.createobject("adodb.recordset")
strsql="select ID from HY where NC='"& username & "'"
rs1.open strsql,conn,1,1
sendid=rs1("ID")
rs1.close
set rs1=nothing
message=""&username&"送您一份礼物,请前往我的服装柜查收。"
sql = "Insert Into LY (NC,ID,NR,ZT,SJ,LB) Values('"
sql = sql & guser & "',"& sendid &",'"& message & "',0,'"&ConvertDateTime(Now())&"',0)"
conn.execute(sql)
%>
<table><tr><td align=center>恭喜,物品赠送成功!</td></tr><%response.write "<meta http-equiv=refresh content=""3;url=shoped.asp"">"%><tr><td>系统将自动在3秒后返回购物车,您现在可以选择下面操作:
<UL><li><a href=/><font color=#000000>返回中央广场</font></a></li>
<li><a href=shoped.asp><font color=#000000>返回我的购物车</font></a></li>
<li><a href=shop.asp><font color=#000000>返回商店列表</font></a></li></UL>
</td></tr></table></td></tr></table></center></body></html>
<%
end if
connshop.close
set connshop=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -