<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->
<%call head()
call saycarda("元宝兑换"&getcent&"")

dim yibi,centstr,action
action=request("action")
if action="ok" then
yibi=request("yibi")
if yibi="" or IsNumeric(yibi)=False then
Calll Error("选择兑换数量出错了！")
end if
if yibi<>"1" and yibi<>"5" and yibi<>"10" and yibi<>"30" and yibi<>"50" and yibi<>"100" then
Call Error("选择兑换数量出错了！")
end if

yibi=abs(int(yibi))

if rmbcent < yibi then
Call Error("您的元宝不足！")
end if


dim gettojb
if yibi=1 then 
gettojb=tojb1
elseif yibi=5 then
gettojb=tojb2
elseif yibi=10 then
gettojb=tojb3
elseif yibi=30 then
gettojb=tojb4
elseif yibi=50 then
gettojb=tojb5
elseif yibi=100 then
gettojb=tojb6
end if

conn.execute("update users set myjb=myjb+"&abs(gettojb)&",rmbcent=rmbcent-"&yibi&" where id="&myid)



%>
兑换成功！
成功兑换<%=gettojb%><%=getcent%><br/>
<%else


if saytk>1 then
	Response.write "<form name=""form"" method=""post"" action=""paycent.asp?saytk="&saytk&"&amp;sid="&sid&""">"

%>
您现有<%=myjb%><%=getcent%><br/>
您现有<%=rmbcent%>个元宝<br/>
<select name="yibi"><option>兑换数量</option>
<%
else
%>
您现有<%=myjb%><%=getcent%><br/>
您现有<%=rmbcent%>个元宝<br/>
输入兑换数量：
<select name="yibi" value="1">
<%end if%>
<option value="1">1元宝兑换<%=tojb1%><%=getcent%></option>
<option value="5">5元宝兑换<%=tojb2%><%=getcent%></option>
<option value="10">10元宝兑换<%=tojb3%><%=getcent%></option>
<option value="30">30元宝兑换<%=tojb4%><%=getcent%></option>
<option value="50">50元宝兑换<%=tojb5%><%=getcent%></option>
<option value="100">100元宝兑换<%=tojb6%><%=getcent%></option>
</select><br/>

<%
if saytk>1 then
call xltjlj("action","ok")%>
<input type="submit" name="Submit" value="确认"></form><br/><%
else%>
<anchor>确定兑换<go href="paycent.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>" method="post">
<postfield name="yibi" value="$(yibi)"/>
<postfield name="action" value="ok"/>
</go></anchor><br/>
<%end if%>
<%end if%>
<a href='uinfo.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>'>返回上级</a>
<!--#include file="fanhui.asp"-->
<%call headsay()%>