$Orders_Sells_Rate = $Row['rate']; $Orders_Sells_Total = $Orders_Sells_Amount * $Orders_Sells_Rate; $Orders_Sells_Total = satoshitrim(satoshitize($Orders_Sells_Total)); $Sells_td .= '<tr> <td align="right" style="padding: 1px;" nowrap><a href="#" onclick="setbuyamounts(' . $Orders_Sells_Amount . ');">' . $Orders_Sells_Amount . '</a></td> <td align="right" style="padding: 1px; padding-left: 10px;" nowrap><a href="#" onclick="setbuyrates(' . $Orders_Sells_Rate . ');">' . $Orders_Sells_Rate . '</a></td> <td align="right" style="padding: 1px; padding-left: 10px;" nowrap>' . $Orders_Sells_Total . '</td> </tr>'; } $buy_subtotal = "0"; $Query = mysql_query("SELECT amount FROM sell_orderbook WHERE want='" . $my_coins->coins_names_prefix[2] . "' and trade_id='" . $my_coins->getTradeId() . "' and processed='1' ORDER BY rate ASC"); while ($Row = mysql_fetch_assoc($Query)) { $buy_amount = $Row['amount']; $buy_subtotal += $buy_amount; } $cncvalue = satoshitrim(satoshitize($buy_subtotal)); echo '<table> <tr> <td colspan="4" align="left" style="font-weight: bold; padding: 2px;" nowrap>Sell Orders</td> </tr><tr> <td colspan="4" align="right" style="padding: 2px;" nowrap>Total ' . $my_coins->coins_names_prefix[1] . ': ' . $cncvalue . '</td> </tr><tr> <td align="left" style="font-weight: bold; padding: 1px;" nowrap>Amount (' . $my_coins->coins_names_prefix[1] . ')</td> <td align="left" style="font-weight: bold; padding: 1px; padding-left: 10px;" nowrap>Rate (' . $my_coins->coins_names_prefix[2] . ')</td> <td align="left" style="font-weight: bold; padding: 1px; padding-left: 10px;" nowrap>Total (' . $my_coins->coins_names_prefix[2] . ')</td> </tr>' . $Sells_td . '</table>'; } else { echo '<table style="width: 260px;"> <tr> <td align="left" style="font-weight: bold; padding: 2px;" nowrap>Sell Orders</td> </tr><tr>
$Trade_Message = 'You do not have enough ' . $BTCS . 's to buy that many ' . $BTCRYXS . 's!'; } } else { $Trade_Message = 'You must enter a rate to buy at!'; } } else { $Trade_Message = 'You must enter an amount to buy!'; } } if ($PST_Order_Action == "sell") { if ($PST_Order_Amount) { if ($PST_Order_Rate) { $PST_Order_Amount = satoshitrim(satoshitize($PST_Order_Amount)); $PST_Order_Rate = satoshitrim(satoshitize($PST_Order_Rate)); $PST_Order_Sub_Total = $PST_Order_Amount * $PST_Order_Rate; $PST_Order_Sub_Total = satoshitrim(satoshitize($PST_Order_Sub_Total)); if ($PST_Order_Amount <= $Coin_B_Balance) { if ($PST_Order_Amount >= "0.00001") { if ($PST_Order_Sub_Total != 0) { if ($Buying_Rate >= $PST_Order_Rate) { if ($Buying_Rate === $PST_Order_Rate) { $Query = mysql_query("SELECT id, username, amount, rate FROM buy_orderbook WHERE want='{$BTC}' and processed='1' and trade_id = '" . $my_coins->getTradeId() . "' AND trade_with = '{$BTCRYX}' ORDER BY rate ASC LIMIT 1"); while ($Row = mysql_fetch_assoc($Query)) { $CURR_Selling_ID = $Row['id']; $CURR_Selling_Username = $Row['username']; $CURR_Selling_Amount = $Row['amount']; $CURR_Selling_Rate = $Row['rate']; } $Client_BTC = userbalance($CURR_Selling_Username, $BTC); $Client_BTCRYX = userbalance($CURR_Selling_Username, $BTCRYX); if ($PST_Order_Amount <= $CURR_Selling_Amount) {
<?php error_reporting(0); $buy_subtotal = "0"; $buy_amounttotal = "0"; $Query = mysql_query("SELECT amount, rate FROM buy_orderbook WHERE want='" . $BTC . "' and trade_id='" . $my_coins->getTradeId() . "' and trade_with = '" . $BTCRYX . "' and processed='1' ORDER BY rate ASC"); while ($Row = mysql_fetch_assoc($Query)) { $buy_amount = $Row['amount']; $buy_rate = $Row['rate']; $buy_subtotal += $buy_amount * $buy_rate; } $btevalue = satoshitrim(satoshitize($buy_subtotal)); $buy_amounttotal = "0"; $Query = mysql_query("SELECT amount FROM sell_orderbook WHERE want='" . $BTC . "' and trade_id='" . $my_coins->getTradeId() . "' and trade_with = '" . $BTCRYX . "' and processed='1' ORDER BY rate ASC"); while ($Row = mysql_fetch_assoc($Query)) { $buy_amount = $Row['amount']; $buy_amounttotal += $buy_amount; } $btevolume = satoshitrim(satoshitize($buy_amounttotal)); echo '<table> <tr> <td nowrap>' . $BTCRYX . '/' . $BTC . '</td> <td style="padding-left: 10px;" nowrap>Volume ' . $btevolume . ' / ' . $btevalue . ' ' . $BTC . '</td> </tr> </table>';
function minusfunds($function_user, $function_coin, $function_amount) { $found_value = false; for ($i = 0; $i < $GLOBALS['cp_count']; $i += 3) { $function_user_balance = userbalance($function_user, $function_coin); $function_balance = $function_user_balance - $function_amount; $function_balance = satoshitrim(satoshitize($function_balance)); if ($function_coin == $GLOBALS['cp'][0 + $i]) { $sql = "UPDATE balances SET coin" . ($i + 1) . "='{$function_balance}' WHERE username='******' AND trade_id = '" . getTradeId($i) . "'"; $found_value = true; } if ($function_coin == $GLOBALS['cp'][2 + $i]) { $sql = "UPDATE balances SET coin" . ($i + 2) . "='{$function_balance}' WHERE username='******' AND trade_id = '" . getTradeId($i) . "'"; $found_value = true; } if ($function_coin == $GLOBALS['cp'][1 + $i]) { $sql = "UPDATE balances SET coin" . ($i + 3) . "='{$function_balance}' WHERE username='******' AND trade_id = '" . getTradeId($i) . "'"; $found_value = true; } if (!$found_value) { continue; } $result = mysql_query($sql); if ($result) { $function_return = "success"; } else { $function_return = "error"; } break; } return $function_return; }
} } else { echo '<option value="7">' . $buy_orderbook["message"] . '</option>'; } ?> </select></td> <td align="left" nowrap><?php echo $BTC; ?> </td> </tr><tr> <td align="right" nowrap><b>Sub-total</b></td> <td align="right" nowrap><select id="sell-subtotal" name="order-total" size="1" onchange="changeIndexBuy('sell-subtotal');"><?php if ($count_buy_orderbook > 0) { for ($i = 0; $i < $count_buy_orderbook; $i++) { $value = satoshitrim(satoshitize($buy_orderbook["amount"][$i] * $buy_orderbook["rate"][$i])); echo '<option value="' . $value . '">' . $value . '</option>'; } } else { echo '<option value="8">' . $buy_orderbook["message"] . '</option>'; } ?> </select></td> <td align="left" nowrap><?php echo $BTC; ?> </td> </tr><tr> <td colspan="3" style="height: 10px;"></td> </tr><tr> <td colspan="3" align="right" nowrap><input type="submit" value="Sell" class="sellbutton"></td>
$Orders_Sells_Rate = $Row['rate']; $Orders_Sells_Total = $Orders_Sells_Amount * $Orders_Sells_Rate; $Orders_Sells_Total = satoshitrim(satoshitize($Orders_Sells_Total)); $Sells_td .= '<tr> <td align="right" style="padding: 1px;" nowrap><a href="#" onclick="setbuyamounts(' . $Orders_Sells_Amount . ');">' . $Orders_Sells_Amount . '</a></td> <td align="right" style="padding: 1px; padding-left: 10px;" nowrap><a href="#" onclick="setbuyrates(' . $Orders_Sells_Rate . ');">' . $Orders_Sells_Rate . '</a></td> <td align="right" style="padding: 1px; padding-left: 10px;" nowrap>' . $Orders_Sells_Total . '</td> </tr>'; } $buy_subtotal = "0"; $Query = mysql_query("SELECT amount FROM sell_orderbook WHERE want='" . $BTC . "' and trade_id='" . $my_coins->getTradeId() . "' and trade_with = '" . $BTCRYX . "' and processed='1' ORDER BY rate ASC"); while ($Row = mysql_fetch_assoc($Query)) { $buy_amount = $Row['amount']; $buy_subtotal += $buy_amount; } $btevolume = satoshitrim(satoshitize($buy_subtotal)); echo '<table> <tr> <td colspan="3" align="left" style="font-weight: bold; padding: 2px;" nowrap>Sell Orders</td> </tr><tr> <td colspan="3" align="right" style="padding: 2px;" nowrap>Total ' . $BTCRYX . ': ' . $btevolume . '</td> </tr><tr> <td align="left" style="font-weight: bold; padding: 1px;" nowrap>Amount (' . $BTCRYX . ')</td> <td align="left" style="font-weight: bold; padding: 1px; padding-left: 10px;" nowrap>Rate (' . $BTC . ')</td> <td align="left" style="font-weight: bold; padding: 1px; padding-left: 10px;" nowrap>Total (' . $BTC . ')</td> </tr>' . $Sells_td . '</table>'; } else { echo '<table style="width: 260px;"> <tr> <td align="left" style="font-weight: bold; padding: 2px;" nowrap>Sell Orders</td> </tr><tr>
function minusfunds($function_user, $function_coin, $function_amount) { $function_user_balance = userbalance($function_user, $function_coin); $function_balance = $function_user_balance - $function_amount; $function_balance = satoshitrim(satoshitize($function_balance)); if ($function_coin == "BTC") { $sql = "UPDATE balances SET coin1='{$function_balance}' WHERE username='******'"; } if ($function_coin == "BTE") { $sql = "UPDATE balances SET coin2='{$function_balance}' WHERE username='******'"; } if ($function_coin == "LTC") { $sql = "UPDATE balances SET coin3='{$function_balance}' WHERE username='******'"; } $result = mysql_query($sql); if ($result) { $function_return = "success"; } else { $function_return = "error"; } return $function_return; }