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

📄 maiing.asp

📁 BBSXP插件!社区比赛用的
💻 ASP
字号:
<!-- #include file="setup.asp" -->
<%
top
if Request.Cookies("username")=empty then
response.redirect "login.asp"
end if

if instr(Request.Cookies("username")," ")>0 then:error("<li>非法操作"):end if
sql="select * from [user] where username='"&Request.Cookies("username")&"'"
rs.Open sql,Conn,1,3

if Request.Cookies("userpass")<>rs("userpass") then
error2("密码错误!")
end if
rs.close

username=Request.Cookies("username")

select case Request("menu")
case "buy"
succtitle="购买成功!"
buy
case "wuqi"
succtitle="购买成功!"
wuqi
case "anqi"
succtitle="购买成功!"
anqi
case "fangju"
succtitle="购买成功!"
fangju
case "colony"
succtitle="购买成功!"
colony
case "maiing"
succtitle="卖出成功!"
maiing
end select


sub buy
buys=request("buys")
vs=HTMLEncode(Request("vs"))
if buys="" then
error("请选中你要买的物品!")
end if
If conn.Execute("Select id From [user] where username='"&vs&"'" ).eof Then
error("<li>系统不存在"&vs&"的资料")
end if
Set rs1 = Server.CreateObject("ADODB.Recordset")
rs.Open "select * from [tools] where toolname='"&buys&"'",Conn,1,3
rs1.Open "select * from [user] where username='"&username&"'",Conn,1,3
if rs1("money") < rs("price") then
error("你的现金不够!")
end if
rs1("money")=rs1("money")-rs("price")
if rs1("userlife") < 10 then
error("你的体力不够!")
end if
rs1("userlife")=rs1("userlife")-10
rs1.update
rs1.close

if rs("use")=1 then
If conn.Execute("Select experience From [user] where username='"&vs&"'" )(0)<50 Then error("<li>使用对象的经验值少于50,您不能使用该物品")
If conn.Execute("Select userlife From [user] where username='"&vs&"'" )(0)<5 Then error("<li>使用对象的体力值少于5,您不能使用该物品")
if vs=username  then
rs1.Open "select * from [user] where username='"&username&"'",Conn,1,3
rs1("experience")=rs1("experience")+rs("exp")
rs1("magicpower")=rs1("magicpower")+rs("magicpower")
rs1("userlife")=rs1("userlife")+rs("life")
if rs1("userlife")>100 then
rs1("userlife")=100
end if
rs1.update
rs1.close
succeed("你已经购买并使用了<font color=0000FF>"&buys&"</font>,你的经验值增加了<font color=FF0000>"&rs("exp")&"</font>,你的魅力值增加了<font color=FF0000>"&rs("magicpower")&"</font>,你的体力值增加了<font color=FF0000>"&rs("life")&"</font>。<meta http-equiv=refresh content=3;url='shop2.asp'>")

elseif vs<>username  then
if Application(CacheName&"egg")=vs then error("<li>该物品只能送给每人一件!")
Set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.Open "select * from [user] where username='"&vs&"'",Conn,1,3
rs2("experience")=rs2("experience")+rs("exp")
rs2("magicpower")=rs2("magicpower")+rs("magicpower")
rs2("userlife")=rs2("userlife")+rs("life")
if rs2("userlife")>100 then
rs2("userlife")=100
end if
rs2.update
rs2.close
end if
Application(CacheName&"egg") = vs
content="【系统消息】:<font color=0000FF>"&username&"</font>送了一个 <font color=red>"&buys&"</font> 给你,使你的经验值增加了<font color=FF0000>"&rs("exp")&"</font>,你的魅力值增加了<font color=FF0000>"&rs("magicpower")&"</font>,你的体力值增加了<font color=FF0000>"&rs("life")&"</font>"
conn.execute("insert into message(author,incept,content) values ('"&username&"','"&vs&"','"&content&"')")
conn.execute("update [user] set newmessage=newmessage +1 where username='"&vs&"'")
succeed("你已经购买并对<font color=0000FF>"&vs&"</font>使用了<font color=FF0000>"&buys&"</font>,使他的经验值增加了"&rs("exp")&",你的魅力值增加了"&rs("magicpower")&",你的体力值增加了"&rs("life")&"<br>系统已经发通知给<font color=0000FF>"&vs&"</font><meta http-equiv=refresh content=3;url='shop2.asp'>")
rs.close

else
rs1.Open "select * from [mytools] where username='"&vs&"' and toolname='"&buys&"'",Conn,1,3
if rs1.eof then
rs1.addnew
rs1("username")=vs
rs1("toolname")=buys
rs1("info")=rs("info")
rs1("price")=rs("price")
rs1("use")=rs("use")
rs1("buydate")=date
rs1("sum")=1
else
rs1("sum")=rs1("sum")+1
end if
rs1.update
rs1.close
rs.close
if vs=username then
succeed("你已经购买了<font color=0000FF>"&buys&"</font>,你可以在你的个人物品中使用或查看它!<meta http-equiv=refresh content=3;url='shop2.asp'>")
else
content="【系统消息】:为表示友好"&[username]&"送了一个 <font color=red>"&buys&"</font> 给你!"
conn.execute("insert into message(author,incept,content) values ('"&username&"','"&vs&"','"&content&"')")
conn.execute("update [user] set newmessage=newmessage +1 where username='"&vs&"'")
succeed("你已经为<font color=0000FF>"&vs&"</font>购买了<font color=FF0000>"&buys&"</font>,系统已经发通知给<font color=0000FF>"&vs&"</font>。<meta http-equiv=refresh content=3;url='shop2.asp'>")
end if
end if
end sub

sub colony
content=HTMLEncode(Request("content"))
if content="" then
error2("请填写群发内容!")
end if
sql="select * from [user] where username='"&Request.Cookies("username")&"'"
rs.Open sql,Conn,1,3
if rs("money")<1000 then
error("<li>您的金币不够!")
end if
rs("money")=rs("money")-1000
rs.update
rs.close
sql="select username from online where username<>''"
rs.Open sql,Conn
do while not rs.eof
Count=Count+1


conn.Execute("insert into message (author,incept,content) values ('"&Request.Cookies("username")&"','"&rs("username")&"','【会员广播】:"&content&"')")

conn.execute("update [user] set newmessage=newmessage+1 where username='"&rs("username")&"'")
rs.movenext
loop
rs.close
succeed("消息发送成功!共发送给 "&Count&" 位在线会员<meta http-equiv=refresh content=3;url='shop2.asp'>")
end sub


sub wuqi
buys=HTMLEncode(Request("buys"))
if buys="" then
error("请选中你要买的物品!")
end if

Set rs1 = Server.CreateObject("ADODB.Recordset")
Set rs2 = Server.CreateObject("ADODB.Recordset")
rs.Open "select * from [tools] where toolname='"&buys&"'",Conn,1,3
rs1.Open "select * from [user] where username='"&username&"'",Conn,1,3
if rs1("money") < rs("price") then
error("你的现金不够!")
end if
if rs1("userlife") < 10 then
error("你的体力不够!")
end if

rs2.Open "select * from [mytools] where username='"&username&"' and use=2",Conn,1,3
if rs2.eof then
rs2.addnew
rs2("username")=username
rs2("toolname")=buys
rs2("info")=rs("info")
rs2("price")=rs("price")
rs2("use")=rs("use")
rs2("buydate")=date
rs2("sum")=1
rs2.update
rs1("userlife")=rs1("userlife")-10
rs1("money")=rs1("money")-rs("price")
rs1.update
else
error("你已经拥有武器,如果你想换一件更好的武器,请先到当铺卖掉旧武器,再来购买新武器!")
end if
rs1.close
rs2.close
rs.close
succeed("你已经购买了<font color=0000FF>"&buys&"</font>,你可以在打擂时使用它来提高你的战胜几率!<meta http-equiv=refresh content=3;url='wqshop.asp'>")
end sub

sub anqi
buys=HTMLEncode(Request("buys"))
if buys="" then
error("请选中你要买的物品!")
end if

Set rs1 = Server.CreateObject("ADODB.Recordset")
Set rs2 = Server.CreateObject("ADODB.Recordset")
rs.Open "select * from [tools] where toolname='"&buys&"'",Conn,1,3
rs1.Open "select * from [user] where username='"&username&"'",Conn,1,3
if rs1("money") < rs("price") then
error("你的现金不够!")
end if
if rs1("userlife") < 10 then
error("你的体力不够!")
end if
rs1.update

rs2.Open "select * from [mytools] where username='"&username&"' and use=3",Conn,1,3
if rs2.eof then
rs2.addnew
rs2("username")=username
rs2("toolname")=buys
rs2("info")=rs("info")
rs2("price")=rs("price")
rs2("use")=rs("use")
rs2("buydate")=date
rs2("sum")=1
rs2.update
rs1("userlife")=rs1("userlife")-10
rs1("money")=rs1("money")-rs("price")
rs1.update
else
error("你已经拥有暗器,如果你想换一件更好的暗器,请先到当铺卖掉旧暗器,再来购买新暗器!")
end if
rs1.close
rs2.close
rs.close
succeed("你已经购买了<font color=0000FF>"&buys&"</font>,你可以在打擂时使用它来提高你的战胜几率!<meta http-equiv=refresh content=3;url='aqshop.asp'>")
end sub


sub fangju
buys=HTMLEncode(Request("buys"))
if buys="" then
error("请选中你要买的物品!")
end if

Set rs1 = Server.CreateObject("ADODB.Recordset")
Set rs2 = Server.CreateObject("ADODB.Recordset")
rs.Open "select * from [tools] where toolname='"&buys&"'",Conn,1,3
rs1.Open "select * from [user] where username='"&username&"'",Conn,1,3
if rs1("money") < rs("price") then
error("你的现金不够!")
end if
if rs1("userlife") < 10 then
error("你的体力不够!")
end if
rs1.update

rs2.Open "select * from [mytools] where username='"&username&"' and use=4",Conn,1,3
if rs2.eof then
rs2.addnew
rs2("username")=username
rs2("toolname")=buys
rs2("info")=rs("info")
rs2("price")=rs("price")
rs2("use")=rs("use")
rs2("buydate")=date
rs2("sum")=1
rs2.update
rs1("userlife")=rs1("userlife")-10
rs1("money")=rs1("money")-rs("price")
rs1.update
else
error("你已经拥有防具,如果你想换一件更好的防具,请先到当铺卖掉旧防具,再来购买新防具!")
end if
rs1.close
rs2.close
rs.close
succeed("你已经购买了<font color=0000FF>"&buys&"</font>,你可以在打擂时使用它来提高你的战胜几率!<meta http-equiv=refresh content=3;url='fjshop.asp'>")
end sub


sub maiing


end sub
%>

⌨️ 快捷键说明

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