<?php
error_reporting(0);
require_once("../../check.php");
require_once("../../../config.php");
isset($_POST['jinbi'])?$jinbi=$_POST['jinbi']:$jinbi=null;
$usersql = "select * from dunling_user where username='$username'";
$userery = mysql_query($usersql,$config);
$user = mysql_fetch_array($userery);
$userjinbi = $user['jinbi'];
if($jinbi>$userjinbi){
    echo 'userjinbierror';
    exit;
}
$minpaysql = "select jinbivsrmb from dunling_config where id='1'";
$minpayery = mysql_query($minpaysql,$config);
$pay = mysql_fetch_array($minpayery);
$bili = $pay['jinbivsrmb'];
$rmb = $jinbi/$bili;//兑换出来的人民币数值

$zengsql = "update dunling_user set jinbi=jinbi-'$jinbi',money=money+'$rmb',zmoney=zmoney+'$rmb' where username='$username'";
$zengery = mysql_query($zengsql,$config);
mysql_close($config);
echo 'ok';
exit;
?>