<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->
<card id="main" title="帖子道具购买" >
<p>
<%call head()
dim action
dim userid,ids,TP
userid=myid

if userid="" or IsNumeric(userid)=False then
  Call Error("会员ID无效！")
  end if
'检查ID是否存在
dim username
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT name FROM users where id="&userid,conn,1,1
if rs.eof then
  rs.close
  set rs=Nothing
  Call Error("会员ID不存在！")
end if
username=rs("name")
  rs.close
  set rs=Nothing
  
TP=request("TP")
action=request("action")
Select Case action
	Case "get"   
		Call xxget()
	Case "del" 
		Call xxdel()
end select 
sub xxget()
if TP<>"" then
TP=clng(TP)
if TP=1 then
tou=request("tou")
if tou="" then
  Call Error("选择道具无效！")
  end if
end if
tou="(img)"&tou&"(/img)"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT tzdj FROM sell where id="&userid,conn,1,2
if rs("tzdj")<>"" then
rs("tzdj")=tou & rs("tzdj")
else
rs("tzdj")=tou
end if
rs.update
rs.close
set rs=Nothing
if 100000<>0 then
if clng(myjb)<100000 then 
  Call Error("购买失败,您没有100000"&getcent&"！")
end if
end if
 response.write "恭喜您购买成功！扣除100000"&getcent&"<br/>"
conn.execute("update Users set myjb=myjb-100000 where ID="&myid)
ELSE


response.write "购买用户"&username&"ID："&userid&"<br/>"

response.write "请选择道具<br/>"
response.write "<select name='tou'><option>道具商品列表</option>"
set rs=server.createobject("ADODB.Recordset")
rs.open"select tou,name from xundj order by id desc",conn,1,1
dim j
j=1
do while not rs.eof
Response.write "<option value='" & ubb(rs("tou")) & "'>" & ubb(rs("name")) & "</option>"
j=j+1
rs.movenext
loop
rs.close
set rs=nothing
Response.write "</select><br/>"
Response.write "<anchor>确定购买<go href='djgoumai.asp?action=get&amp;saytk="&saytk&"&amp;sid="&sid&"' method='post' accept-charset='utf-8'>"
Response.write "<postfield name='tou' value='$(tou)'/>"
Response.write "<postfield name='userid' value='"&userid&"'/>"
Response.write "<postfield name='TP' value='1'/>"
Response.write "</go></anchor><br/>"
END IF
end sub
sub xxdel()
if TP<>"" then
conn.Execute("update sell set tzdj='' where id="&userid)
response.write "操作成功<br/>"
else
 Response.Write "真的要删除该会员的所有帖子道具？<br/>"
 Response.Write "<a href='adminxxxdj.asp?Action=del&amp;userid="&userid&"&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;TP=1'>是的</a><br/>"
 Response.Write "<anchor>取消<prev/></anchor><br/>"
end if
end sub

Response.write "------------<br/>"
conn.close
set conn=Nothing

%>
<!--#include file="fanhui.asp"-->
</p></card>
</wml>