<!--#include file="conn.asp"-->
<!--#include file="webconfig.asp"-->
<%
if request.Cookies("bjx")("username")="" then
response.Redirect "user.asp"
response.End
end if

set bjx=server.CreateObject("adodb.recordset")
bjx.open "select * from [user] where username='"&request.Cookies("bjx")("username")&"' ",conn,1,3
jf=bjx("jifen")
yc=bjx("yucun")
action=request("act")

if action="jifen" then
jifen=trim(request("jifen"))
if not isInteger(jifen) then
response.write"<script>alert(""非法换算!"");history.go(-1);</script>"
else

if jf-jifen<0 then 
response.write"<script>alert(""你们没有这么多积分可以换算!"");history.go(-1);</script>"
else

bjx("jifen")=jf-jifen
bjx("yucun")=yc+(jifen/2)
bjx.update
response.redirect "user.asp"
end if
end if
end if

if action="cunkuan" then
cunkuan=trim(request("cunkuan"))
if not isInteger(cunkuan) then
response.write"<script language=javascript>alert(""非法换算!"");history.go(-1);</script>"
else

if yc-cunkuan<0 then 
response.write"<script language=javascript>alert(""你们没有这么多预存款可以换算!"");history.go(-1);</script>"
else

bjx("jifen")=jf+(cunkuan*2)
bjx("yucun")=yc-cunkuan
bjx.update
response.redirect "user.asp"
end if
end if
end if
%>