<% @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
<!--#include file="../inc.asp"-->
<!--#include file="../ydzq.asp"-->
<!--#INCLUDE file="conn1.asp"-->
<%
call head()
call cardz("使用物品","index.asp?sid="&request("sid")&"&amp;saytk="&request("saytk")&"")
wpid=request("wpid")
%>
<%
if wpid="y1" then
tstl="100"
yname="百草丹"

elseif wpid="y2" then
tstl="200"
yname="大力神丹"

elseif wpid="y3" then
tstl="300"
yname="九转还魂丹"

elseif wpid="y4" then
tstl="600"
yname="九转还魂丹"
else
tstl="60000"
yname="江湖强力魔水"
end if
Server.ScriptTimeout=999
set rs=Server.CreateObject("ADODB.Recordset")
strsQL="select "&wpid&" from wupin where cstr(ids)='"&myid& "'"
rs.open strsQL,liao,1,1
if rs(""&wpid&"")<1 then
msg="您没有该药品！快去<a href='yao.asp?sid="&sid&"&amp;saytk="&saytk&"'>王五药铺</a>买一点吧"
else
set rs8=Server.CreateObject("ADODB.Recordset")
strsQL="select xue,tl from sx where cstr(ids)='"&myid& "'"
rs8.open strsQL,liao,1,1
myjy=rs8("xue")
mytl=rs8("tl")
 rs8.Close
	Set rs8=Nothing
if mytl=myjy then
msg="您的身体已经够棒了，不能再用任何药品！"
elseif clng(tstl+mytl)>=clng(myjy) then
sql="update sx set tl="&myjy&" where cstr(ids)="&myid
  liao.Execute(sql)
sql="update wupin set "&wpid&"="&wpid&"-1 where cstr(ids)="&myid
  liao.Execute(sql)
msg="您服用了"&yname&"后,身体感觉好多了,体力提升"&tstl&".<br/><br/>"
else
sql="update sx set tl=tl+"&tstl&" where cstr(ids)="&myid
  liao.Execute(sql)
sql="update wupin set "&wpid&"="&wpid&"-1 where cstr(ids)="&myid
  liao.Execute(sql)
msg="您服用了"&yname&"后,身体感觉好多了,体力提升"&tstl&".<br/><br/>"
END IF
end if
Response.Write ""&msg&"正在返回......<br/>=========<br/>"
 rs.Close
	Set rs=Nothing
     liao.Close
      Set liao=Nothing
%>
<a href="index.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>">[我的江湖]</a><br/>
<a href="/bbs/index.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>">[社区首页]</a><br/>
<%call head1()%>