Exemplo n.º 1
0
         $balanceuser2 += $balanceadmin;
     } else {
         if ($target == "admin") {
             $balancetarget2 += $balanceadmin;
         } else {
             $currentbalanceadmin = BaseDonnee::execQuery($bdd, "SELECT * FROM balances WHERE Account='admin' AND Coin = '{$coin2}'")[0]["Amount"];
             $newadminbalance = floatval($currentbalanceadmin) + $balanceadmin;
             BaseDonnee::setBalance($bdd, "admin", $coin2, $newadminbalance);
         }
     }
     BaseDonnee::setHelding($bdd, $target, $coin1, $targethelding1 - $tmphelding1);
     BaseDonnee::setHelding($bdd, $target, $coin2, $targethelding2 - $tmphelding2);
     BaseDonnee::setBalance($bdd, $target, $coin1, $balancetarget1 - $tmphelding1);
     BaseDonnee::setBalance($bdd, $target, $coin2, $balancetarget2 - $tmphelding2);
     BaseDonnee::setBalance($bdd, $username, $coin1, $balanceuser1);
     BaseDonnee::setBalance($bdd, $username, $coin2, $balanceuser2);
     echo "<p>terminés</p>";
 }
 //ici, on verifie que $amount soit bien egal à 0. si non, plus de trade possible : on effectue un order pour le reste.
 if ($amount != 0) {
     echo "<p>Plus d'autres targets, on effectue un " . $type . " order d'amount " . $amount . "</p>";
     $total = floatval(number_format($amount * $value, 8));
     BaseDonnee::addTrade($bdd, $type, $username, number_format($amount, 8, '.', ''), number_format($value, 8, '.', ''), $pair, $fee, $total);
     //On ajoute aussi le helding pour cet order
     $helding1 = 0.0;
     $helding2 = 0.0;
     if ($type == "BUY") {
         $helding2 += (double) ($total + $total * $fee / 100);
     } else {
         $helding2 += (double) ($total * $fee / 100);
         $helding1 += (double) $amount;
Exemplo n.º 2
0
                $votes = BaseDonnee::execQuery($bdd, "SELECT * FROM Votes WHERE Address = '{$address}'");
                if (!empty($votes)) {
                    $voteNumber = intval($votes[0]["Total"]);
                    $voteAdd = round($amount / 0.0002, 0, PHP_ROUND_HALF_DOWN);
                    if ($voteAdd >= 1) {
                        BaseDonnee::editVoteTotal($bdd, "BTC", $voteNumber + $voteAdd);
                    }
                    continue;
                }
            }
            /*Reception de coins par un wallet tiers (deposit)
             * Mise à jour de la balance de l'user */
            if (intval($transaction["confirmations"]) >= 4) {
                $balance = BaseDonnee::execQuery($bdd, "SELECT * FROM balances WHERE Coin = '{$coin}' AND Account='{$account}'")[0]["Amount"];
                $newbalance = floatval($balance) + $amount;
                BaseDonnee::setBalance($bdd, $account, $coin, $newbalance);
                //Ajout d'un deposit en BDD afin d'en retracer l'historique
                BaseDonnee::addDeposit($bdd, $account, $amount, 1, $txid, $row["Acronymn"], intval($transaction["confirmations"]));
            } else {
                //Une transaction a été detectée mais elle a moins de 4 confirmations
                BaseDonnee::addDeposit($bdd, $account, $amount, 0, $txid, $row["Acronymn"], intval($transaction["confirmations"]));
                echo "add deposit de " . $amount . $row["Acronymn"];
            }
            //On sauvegarde en BDD notre avancement en inserant le hash de la derniere transaction
            BaseDonnee::setHash($bdd, $walletid, $newhash);
        }
    }
}
function sortBySubkey(&$array, $subkey, $sortType = SORT_ASC)
{
    foreach ($array as $subarray) {
Exemplo n.º 3
0
                    if (empty($targetbalance)) {
                        echo "Wallet maintenance, please retry later";
                        die;
                    }
                    $newtargetbalance = $targetbalance + $amount - $fee;
                    BaseDonnee::setBalance($bdd, $target, $coin, $newtargetbalance);
                } else {
                    $feeForAdmin = (double) sprintf("%.8f", $fee - $txfee);
                }
                if ($feeForAdmin > 0) {
                    //Admin informations
                    $adminid = BaseDonnee::execQuery($bdd, "SELECT * FROM Users WHERE Username='******'")[0]["User_ID"];
                    $adminbalance = BaseDonnee::execQuery($bdd, "SELECT * FROM balances WHERE Account='admin' AND Coin = '{$coin}'")[0]["Amount"];
                    $newbalanceadmin = $adminbalance + $feeForAdmin;
                    $wallet->Client->move($username, "admin", $feeForAdmin);
                    BaseDonnee::setBalance($bdd, "admin", $coin, $newbalanceadmin);
                }
                header("Location: /users/winwithdrawal.php");
                exit;
            } catch (Exception $e) {
                $_SESSION["erreurs"]["general"] = $e->getMessage();
            }
        }
    }
}
?>

<head>
	<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
	<link href="../css/style.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>