Esempio n. 1
0
                     }
                     $Client_BTC = userbalance($CURR_Selling_Username, $BTC);
                     $Client_BTCRYX = userbalance($CURR_Selling_Username, $BTCRYX);
                     if ($PST_Order_Amount <= $CURR_Selling_Amount) {
                         $Trade_Message = 'Could, Trade matching not done.';
                     } else {
                         $Trade_Message = 'Trade matching not done.';
                     }
                 } else {
                     $Trade_Message = 'Trade matching not done.';
                 }
             } else {
                 if (!mysql_query("INSERT INTO sell_orderbook (id, date, ip, username, action, want, initial_amount, amount, rate, processed, trade_id, trade_with) VALUES ('','{$date}','{$ip}','{$user_session}','sell','{$BTC}','{$PST_Order_Amount}','{$PST_Order_Amount}','{$PST_Order_Rate}','1','" . $my_coins->getTradeId() . "','{$BTCRYX}')")) {
                     $Trade_Message = "System error.";
                 } else {
                     $result = minusfunds($user_session, $BTCRYX, $PST_Order_Amount);
                     if ($result == "success") {
                         $Trade_Message = "Sell order has been made, but is waiting a Buyer.";
                         //header("Location: home.php");
                     } else {
                         $Trade_Message = "System error.";
                     }
                 }
             }
         } else {
             $Trade_Message = "That amount is to low? Try more coins or a higher rate.";
         }
     } else {
         $Trade_Message = 'Orders that total under 0.00001 are not allowed!';
     }
 } else {
}
$iid = $my_coins->getSelectInstanceId();
$cid = $my_coins->getCoinsSelectInstanceId() + 1;
if ($withdraw_withdraw == "withdraw") {
    if ($withdraw_address) {
        if ($withdraw_amount) {
            $withdraw_amount = satoshitize($withdraw_amount);
            if ($withdraw_amount <= $Bitcrystald_Balance[$iid]) {
                $fee = $my_coins->coins[$my_coins->coins_names[$cid]]["fee"];
                $FEEBEE = $my_coins->coins[$my_coins->coins_names[$cid]]["FEEBEE"];
                $set_withdraw_amount = $withdraw_amount - $fee;
                // minus the fee
                $true_withdraw_amount = satoshitize($set_withdraw_amount);
                $Bitcrystald_Withdraw_From = $Bitcrystald[$iid]["daemon"]->sendtoaddress($withdraw_address, (double) $true_withdraw_amount);
                if ($Bitcrystald_Withdraw_From) {
                    $result = minusfunds($user_session, $my_coins->coins_names_prefix[$cid], $withdraw_amount);
                    $result = plusfunds($FEEBEE, $my_coins->coins_names_prefix[$cid], $fee);
                    // add fee to feebee account
                    $Bitcrystald_Balance = userbalance($user_session, $my_coins->coins_names_prefix[$cid]);
                    $withdraw_message = '<a href="#' . $Bitcrystald_Withdraw_From . '" target="_blank" style="color: #0B2161;">Withdraw was sent!<br>' . $Bitcrystald_Withdraw_From . '</a>';
                    if (!mysql_query("INSERT INTO transactions (id,date,username,action,coin,address,txid,amount,trade_id) VALUES ('','{$date}','{$user_session}','withdraw','" . $my_coins->coins_names_prefix[$cid] . "','{$withdraw_address}','{$Bitcrystald_Withdraw_From}','{$withdraw_amount}','" . $my_coins->getTradeId() . "')")) {
                        $eereturn_error = "System error.";
                    } else {
                        $eereturn_error = "Logged in.";
                    }
                }
            } else {
                $withdraw_message = 'You do not have enough ' . $my_coins->coins_names[$cid] . 's!';
            }
        } else {
            $withdraw_message = 'No amount to withdraw was entered!';
     $rate = $Row['rate'];
     if ($username != $buyer) {
         $id = false;
         break;
     }
 }
 if (!$id) {
     $Trade_Message = 'Could, Trade matching not done. 5';
     $trade_error = true;
 }
 if (!$trade_error) {
     $coin_balance = $Coin_B_Balance;
     $totalamount = $amount * $rate;
     $totalamount = satoshitrim(satoshitize($totalamount));
     if ($coin_balance >= $amount) {
         $result1 = minusfunds($user_session, $BTCRYX, $amount);
         $result2 = plusfunds($username, $BTCRYX, $amount);
         if ($result1 == "success" && $result2 == "success") {
             $result = plusfunds($user_session, $BTC, $totalamount);
             if ($result == "success") {
                 $handler = $buyer;
                 $Query = "INSERT INTO ordersfilled (date, ip, username, trader, oid, action, want, amount, rate, total, processed, trade_id, trade_with) VALUES ('{$date}', '{$ip}', '{$handler}', '{$trader}', '{$trade_id}', '{$my_action_2}', '{$BTC}', '{$amount}', '{$rate}', '{$totalamount}', '{$processed}', '" . $my_coins->getTradeId() . "', '{$BTCRYX}');";
                 //echo $Query."<br/>";
                 if (!mysql_query($Query)) {
                     $Trade_Message = 'Could, Trade matching not done. 6';
                     $trade_error = true;
                 }
                 $Trade_Message = "Trade is complete!";
             } else {
                 $Trade_Message = 'Could, Trade matching not done. 7';
                 $trade_error = true;
if (!$iid) {
    $my_coins->setSelectInstanceId($my_coins->getInstanceId());
} else {
    if ($iid != $my_coins->getSelectInstanceId()) {
        header("Location: home.php");
    }
}
$iid = $my_coins->getSelectInstanceId();
$cid = $my_coins->getCoinsSelectInstanceId();
if ($savemoney == "savemoney") {
    $id = 1 + $cid;
    $wallet_id = "zellesExchange(" . $user_session . ")";
    $FEEBEE = $my_coins->coins[$my_coins->coins_names[$id]]["FEEBEE"];
    $wallet_id_feebee = "zellesExchange(" . $FEEBEE . ")";
    $my_balance = userbalance($user_session, $my_coins->coins_names_prefix[$id]);
    $result = minusfunds($user_session, $my_coins->coins_names_prefix[$id], $my_balance);
    $my_balance_n = $my_coins->set_coins_balance($my_coins->coins_names[$id], $wallet_id, $wallet_id_feebee, $my_balance);
    $result = plusfunds($user_session, $my_coins->coins_names_prefix[$id], $my_balance_n);
    // add fee to feebee account
    $Bitcrystald_Balance[$iid] = userbalance($user_session, $my_coins->coins_names_prefix[$id]);
    $savemoney_message = 'success';
}
?>
<html>
<head>
   <title><?php 
echo $script_title;
?>
</title>
   <link rel="shortcut icon" href="image/favicon.ico">
   <?php 
Esempio n. 5
0
    header("Location: index.php");
}
$withdraw_withdraw = security($_POST['action']);
$withdraw_amount = security($_POST['amount']);
$withdraw_address = security($_POST['address']);
if ($withdraw_withdraw == "withdraw") {
    if ($withdraw_address) {
        if ($withdraw_amount) {
            $withdraw_amount = satoshitize($withdraw_amount);
            if ($withdraw_amount <= $Chncoind_Balance) {
                $set_withdraw_amount = $withdraw_amount - 0.01;
                // minus the fee
                $true_withdraw_amount = satoshitize($set_withdraw_amount);
                $Chncoind_Withdraw_From = $Chncoind->sendtoaddress($withdraw_address, (double) $true_withdraw_amount);
                if ($Chncoind_Withdraw_From) {
                    $result = minusfunds($user_session, "LTC", $withdraw_amount);
                    $result = plusfunds($FEEBEE, "LTC", "0.01");
                    // add fee to feebee account
                    $Chncoind_Balance = userbalance($user_session, "LTC");
                    $withdraw_message = '<a href="#' . $Chncoind_Withdraw_From . '" target="_blank" style="color: #0B2161;">Withdraw was sent!<br>' . $Chncoind_Withdraw_From . '</a>';
                    if (!mysql_query("INSERT INTO transactions (id,date,username,action,coin,address,txid,amount) VALUES ('','{$date}','{$user_session}','withdraw','LTC','{$withdraw_address}','{$Chncoind_Withdraw_From}','{$withdraw_amount}')")) {
                        $eereturn_error = "System error.";
                    } else {
                        $eereturn_error = "Logged in.";
                    }
                }
            } else {
                $withdraw_message = 'You do not have enough Litecoins!';
            }
        } else {
            $withdraw_message = 'No amount to withdraw was entered!';