Exemplo n.º 1
0
        $amount = (double) sprintf("%.8f", $order["Amount"]);
        $value = (double) sprintf("%.8f", $order["Value"]);
        $total = (double) sprintf("%.8f", $amount * $value);
        if ($order["Type"] == "BUY") {
            $helding2 += $total + $total * $fee / 100;
        } else {
            $helding2 += $total * $fee / 100;
            $helding1 += $amount;
        }
        $newhelding1 = round($sqlbalance1["Helding"], 8) - round($helding1, 8);
        $newhelding2 = round($sqlbalance2["Helding"], 8) - round($helding2, 8);
        BaseDonnee::setHelding($bdd, $username, $coin1, $newhelding1);
        BaseDonnee::setHelding($bdd, $username, $coin2, $newhelding2);
        //Envoi d'une notification
        $text = "Your order {$id} has been cancelled.";
        BaseDonnee::addNotification($bdd, $username, "information", $text);
        //Envoi d'une notification end
        $c = BaseDonnee::deleteTrade($bdd, $id);
        if ($pageorder) {
            header("Location: /users/orders.php");
        } else {
            header("Location: /users/trades.php?market=" . $pair);
        }
        exit;
    }
}
// Pour ajouter un order
if (isset($_POST["type"], $_POST["amount"], $_POST["price"], $_POST["pair"])) {
    $username = $_SESSION["pseudo"];
    $erreurs = array("amount" => "", "value" => "", "price" => "", "general" => "");
    $error = false;