示例#1
0
try {
    //Verify the txFee is the same
    $walletFee = $wallet->GetTxFee();
    if ($txfee != $walletFee) {
        try {
            $wallet->Client->settxfee($txfee);
        } catch (Exception $e) {
            echo "This wallet is in maintenance, please try later";
            die;
        }
    }
    //Send from the current user account to the specified address
    $address = mysql_real_escape_string($_POST["address"]);
    $transactionamount = $amount - $fee;
    $transactionID = $wallet->Withdraw($bdd, $username, $address, $transactionamount, $coin);
    BaseDonnee::addWithdrawal($bdd, $username, $amount, $address, $coin);
    //update user's balance
    $newbalance = $balance - $amount;
    BaseDonnee::setBalance($bdd, $username, $coin, $newbalance);
    //Move fees to admin
    //If the transaction il in the same wallet, we transert the txfees to the admin and we update target balance
    $doMove = false;
    try {
        $target = $wallet->Client->getaccount($address);
        if ($target != "") {
            $doMove = true;
        }
    } catch (Exception $e) {
        $doMove = false;
    }
    if ($doMove) {