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

    <%@language="VBScript"%>
<!--#include file="title.asp"-->
<!--#include file="sub.asp"-->
<%
Dim handler,toolname,cause,amount,erryes,i
handler=Trim(Replace(Request.Form("username"),"'",""))
toolname=Trim(Replace(Request.Form("toolname"),"'",""))
cause=Trim(Request.Form("cause"))
amount=Request.Form("amount")
if IsNumeric(amount) then
amount=Abs(Clng(amount))
else
amount=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 validate<>creatvalidate(gb+imprison,ip) then
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>"
else
if imprison="2" or imprison="4" or imprison="6" or imprison="7" then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你因为违反社区条例,被禁止使用道具。具体可以查看<a href=""report.asp"">异动报告</a>。<br><br></td></tr>"
else
if handler<>"" and cause<>"" and toolname<>"" 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 "Select amount From tools Where gbmaduser='"& gbmaduser &"' and toolname='"& toolname &"'",conn,1,1
if Not rs.Eof then
if rs("amount")<amount+1 then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你没有 "& amount &" 个 "& toolname &" 赠送给 "& handler &",<a href=""JavaScript:history.back();"">返回重新输入后再试</a>。<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>你没有道具 "& toolname &",不能赠送给 "& handler &"。<br>请确定你是通过正常方式进行操作,如果依旧出错,请<a href=""reporting.asp"">联系管理员报告错误</a>。<br><a href=""JavaScript:history.back();"">返回重新输入后再试</a>。<br><br></td></tr>"
erryes="yes"
end if
rs.Close
end if
if erryes<>"yes" then
rs.Open "Select id From gbmaduser Where gbmaduser='"& handler &"'",conn,1,1
if rs.Eof then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>用户 "& handler &" 不存在,不能接受你赠送的礼盒,<a href=""JavaScript:history.back();"">返回重新输入后再试</a>。<br><br></td></tr>"
erryes="yes"
end if
rs.Close
end if
if erryes<>"yes" then
rs.Open "tools Where gbmaduser='"& gbmaduser &"' and toolname='精美礼盒'",conn,1,3
if Not rs.Eof then
if rs("amount")=1 then
rs.Delete
else
rs("amount")=rs("amount")-1
rs.Update
end if
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你没有精美礼盒,请到<a href=""market.asp"">道具市场</a>购买。<br><br></td></tr>"
erryes="yes"
end if
rs.Close
end if
if erryes<>"yes" then
rs.Open "tools Where gbmaduser='"& gbmaduser &"' and toolname='"& toolname &"'",conn,1,3
if rs("amount")=amount then
rs.Delete
else
rs("amount")=rs("amount")-amount
rs.Update
end if
rs.Close
rs.Open "tools Where gbmaduser='"& handler &"' and toolname='"& toolname &"'",conn,1,3
if rs.Eof then
rs.AddNew
rs("toolname")=toolname
rs("amount")=amount
rs("gbmaduser")=handler
else
rs("amount")=rs("amount")+amount
end if
rs.Update
rs.Close
rs.Open "report Where id=0",conn,1,3
rs.AddNew
rs("gbmaduser")=handler
rs("handler")=gbmaduser
rs("posttime")=Now()
rs("matter")="使用精美礼盒给予道具 "& toolname &":"& amount &"个。"
rs("cause")=cause
rs.Update
rs.Close
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">精美礼盒</td></tr>"&_
"<tr class=""tds""><td>你已成功用精美礼盒将 "& amount &" 个 "& toolname &" 给 "& handler &" 。</td></tr>"
end if
elseif toolname<>"" and handler<>"" and cause="" then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你没有输入赠送礼盒的原因,<a href=""JavaScript:history.back();"">返回重新输入后再试</a>。<br><br></td></tr>"
elseif toolname<>"" and handler="" and cause="" then
rs.Open "Select amount From tools Where gbmaduser='"& gbmaduser &"' and toolname='"& toolname &"'",conn,1,1
if Not rs.Eof then
if toolname="精美礼盒" and rs("amount")=1 then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你只有1个精美礼盒,没有多余的精美礼盒用于赠送。<br><a href=""JavaScript:history.back();"">返回重新选择后再试</a>。<br><br></td></tr>"
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">精美礼盒</td></tr>"&_
"<form name=""giftbox"" onsubmit=""return validinput();"" method=""post"" action=""giftbox.asp"">"&_
"<tr class=""tds""><td>"&_
"<script language=""JavaScript"">"&_
"function validinput()"&_
"{"&_
"if (document.giftbox.username.value.length==0){"&_
"alert(""请填写要接受你赠送礼盒的用户名。"");"&_
"document.giftbox.username.focus();"&_
"return false;"&_
"}"&_
"if (document.giftbox.cause.value.length==0){"&_
"alert(""请填写你要赠送礼盒的原因。"");"&_
"document.giftbox.cause.focus();"&_
"return false;"&_
"}"&_
"if (document.giftbox.amount.value.length==0){"&_
"alert(""请填写你要赠送道具的数量。"");"&_
"document.giftbox.amount.focus();"&_
"return false;"&_
"}"&_
"return true;"&_
"}"&_
"</script>"&_
"你共有 "& toolname &" "& rs("amount") &" 个,请输入接受礼盒的人的用户名和赠送道具的数量以及赠送的原因。<br>"
if toolname="精美礼盒" then contents=contents &"提醒,你要赠送的是精美礼盒,因为在包装时要使用一个,所以你只能赠送 "& rs("amount")-1 &" 个。<br>"
contents=contents &"<br>"&_
"<input type=""hidden"" name=""toolname"" value="""& toolname &""">"&_
"接受用户:<input name=""username"" type=""text"" maxlength=""20"" size=""20"" class=""iptwin""><br>"&_
"赠送原因:<input name=""cause"" type=""text"" maxlength=""255"" size=""20"" class=""iptwin""><br>"&_
"赠送数量:<input name=""amount"" type=""text"" maxlength=""10"" size=""10"" class=""iptwin"">"&_
" <input name=""button"" type=""submit"" value=""提交"" onmouseover=""this.className='over';"" onmouseout=""this.className='out';"" class=""out""></td></tr>"&_
"</form>"
end if
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">出错</td></tr><tr><td><br>你没有道具 "& toolname &"。<br>请确定你是通过正常方式进行操作,如果依旧出错,请<a href=""reporting.asp"">联系管理员报告错误</a>。<br><a href=""JavaScript:history.back();"">返回重新选择后再试</a>。<br><br></td></tr>"
end if
rs.Close
else
rs.Open "tools Where gbmaduser='"& gbmaduser &"' Order by toolname",conn,1,1
if rs.Eof then
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">精美礼盒</td></tr><tr><td><br>你还没任何的道具可以用精美礼盒赠送给其他人。<br><br></td></tr>"
else
contents=contents &"<tr class=""toptr""><td class=""tdc"" height=""20"" background="""& theme &"02.gif"">精美礼盒</td></tr>"&_
"<form name=""giftbox"" method=""post"" action=""giftbox.asp"">"&_
"<tr class=""tds""><td>"&_
"请选择你要包装的道具:<select name=""toolname"" size=""1"">"
For i=1 to rs.RecordCount
contents=contents &"<option value="""& rs("toolname") &""">"& rs("toolname") &"</option>"
rs.MoveNext
Next
contents=contents &"</select> <input name=""button"" type=""submit"" value=""提交"" onmouseover=""this.className='over';"" onmouseout=""this.className='out';"" class=""out""></td></tr>"&_
"</form>"
end if
rs.Close
end if
end if
end if
end if
contents=contents &"</table>"&_
""
%>
<!--#include file="bottom.asp"-->