www.gusucode.com > 仿MOP对开式论坛程序 1.0源码程序 > toolsell.asp

    <%@language="VBScript"%>
<!--#include file="title.asp"-->
<%
Dim toolname,amount,price,unsell,i,erryes
toolname=Replace(Request.Form("toolname"),"'","")
unsell=Replace(Request.QueryString("unsell"),"'","")
amount=Request.Form("amount")
if IsNumeric(amount) then
amount=Abs(Clng(amount))
else
amount=0
end if
price=Request.Form("price")
if IsNumeric(price) then
price=Abs(Clng(price))
else
price=0
end if
contents=contents &"<title>出售道具-"& caption &"</title>"&_
"</head>"&_
"<body>"&_
""&_
"<table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%"" class=""tdc"">"
if gbmaduser="" then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你还没登陆或者已经掉线。<br>请<a href=""login.asp"">登陆</a>,2秒后自动执行<Script Language=""JavaScript"">setTimeout(""location.href='login.asp'"",3000)</script>。<br><br></td></tr>"
else
if toolname<>"" and amount>0 and price>0 then
rs.Open "Select userpwd From gbmaduser Where gbmaduser='"& gbmaduser &"'",conn,1,1
if Not rs.Eof then
if rs("userpwd")<>userpwd then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>密码验证错误,请<a href=""login.asp"">重新登陆</a>。<br>引起该错误的原因可能是因为你手动修改了Cookies。<br><br></td></tr>"
erryes="yes"
end if
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>不存在的用户,请<a href=""login.asp"">重新登陆</a>。<br>引起该错误的原因可能是因为你手动修改了Cookies。<br><br></td></tr>"
erryes="yes"
end if
rs.Close
if erryes<>"yes" then
rs.Open "tools Where gbmaduser='"& gbmaduser &"' and toolname='"& toolname &"' and amount>"& amount-1,conn,1,3
if rs.Eof then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你没有 "& amount &" 个 "& toolname &" 让你用于待售。<br><a href=""JavaScript:history.back();"">返回重新输入数量后再试</a>。<br><br></td></tr>"
erryes="yes"
else
if rs("amount")=amount then
rs.Delete
else
rs("amount")=rs("amount")-amount
rs.Update
end if
end if
rs.Close
end if
if erryes<>"yes" then
rs.Open "market Where gbmaduser='"& gbmaduser &"' and toolname='"& toolname &"'",conn,1,3
if rs.Eof then
rs.AddNew
rs("toolname")=toolname
rs("gbmaduser")=gbmaduser
rs("amount")=amount
rs("price")=price
else
rs("amount")=rs("amount")+amount
rs("price")=price
end if
rs.Update
rs.Close
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出售道具</td></tr><tr><td><br>成功待售道具 "& toolname &" "& amount &" 个,价格为每个 "& price &" "& gbname &"。<Script Language=""JavaScript"">window.open(""tools.asp"","""& bbssn &"tools"");</Script><br><br></td></tr>"
end if
elseif toolname<>"" and amount=0 and price=0 then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出售道具</td></tr>"&_
"<form name=""toolsell"" method=""post"" action=""toolsell.asp"">"&_
"<tr class=""tds""><td>"
rs.Open "tools Where gbmaduser='"& gbmaduser &"' and toolname='"& toolname &"'",conn,1,1
if rs.Eof then
contents=contents &"你没有道具: "& toolname &"。<br>请确定你是通过正常方式进行操作,如果依旧出错,请<a href=""reporting.asp"">联系管理员报告错误</a>。"
else
contents=contents & toolname &" 共("& rs("amount") &")个。如果你原先有待售 "& toolname &" 则该道具待售价格为你此次输入价格。<input type=""hidden"" name=""toolname"" value="""& toolname &"""><br><br>出售数量:<input name=""amount"" type=""text"" maxlength=""5"" size=""5"" class=""iptwin""> 出售价格:<input name=""price"" type=""text"" maxlength=""10"" size=""10"" class=""iptwin""> <input name=""button"" type=""submit"" value=""提交"" onmouseover=this.className=""over""; onmouseout=this.className=""out""; class=""out"">"
end if
rs.Close
contents=contents &"</td></tr>"&_
"</form>"
else
if Right(validate,Len(gbmaduser))=gbmaduser then
if unsell<>"" then
rs.Open "market Where gbmaduser='"& gbmaduser &"' and toolname='"& unsell &"'",conn,1,3
if Not rs.Eof then
amount=rs("amount")
rs.Delete
end if
rs.Close
if amount>0 then
rs.Open "tools Where gbmaduser='"& gbmaduser &"' and toolname='"& unsell &"'",conn,1,3
if rs.Eof then
rs.AddNew
rs("toolname")=unsell
rs("amount")=amount
rs("gbmaduser")=gbmaduser
else
rs("amount")=rs("amount")+amount
end if
rs.Update
rs.Close
end if
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">取回道具</td></tr>"&_
"<tr class=""tds""><td>"&_
"取回放在道具超市出售的道具 "& unsell &" "& amount &" 个。"&_
"<Script Language=""JavaScript"">window.open(""tools.asp"","""& bbssn &"tools"");</Script>"&_
"</td></tr>"
end if
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>验证Cookies信息出错,请<a href=""login.asp"">重新登陆</a>。<br>引起该错误的原因可能是因为你手动修改了Cookies。<br><br></td></tr>"
end if
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">待售道具</td></tr>"&_
"<tr class=""tds""><td>"&_
"<table border=""0"" cellpadding=""3"" cellspacing=""3"" width=""100%"">"&_
"<tr class=""toptr""><td width=""25%"">道具名称</td><td width=""25%"">售价</td><td width=""25%"">数量</td><td width=""25%"">取回道具</td></tr>"
rs.Open "market Where gbmaduser='"& gbmaduser &"' Order by toolname",conn,1,1
if rs.Eof then
contents=contents &"<tr><td colspan=""4"">你没有任何待售道具</td></tr>"
else
For i=1 to rs.RecordCount
contents=contents &"<tr class=""otr""><td>"& rs("toolname") &"</td><td>"& rs("price") &"</td><td>"& rs("amount") &"</td><td><a href=""toolsell.asp?unsell="& rs("toolname") &""">全部取回</a></td></tr></form>"
rs.MoveNext
Next
end if
rs.Close
contents=contents &"</table>"&_
"</td></tr>"
end if
end if
contents=contents &"</table>"&_
""
%>
<!--#include file="bottom.asp"-->