Esempio n. 1
0
 $current = time();
 $date = BaseDonnee::execQuery($bdd, "SELECT Timestamp FROM Withdraw_History WHERE User = '******'")[0]["Timestamp"];
 $difference = $current - strtotime($date);
 if ($difference < 30) {
     $error = true;
     $_SESSION["erreurs"]["general"] = "Please wait at least 30 seconds for make another withdraw</br>";
 }
 $success = BaseDonnee::mdpValide($bdd, $username, $_POST["password"]);
 if (!$success) {
     $_SESSION["erreurs"]["password"] = "******";
     $error = true;
 } else {
     if (!$error) {
         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;