Ejemplo n.º 1
0
 public function postOrder(CreateOrderRequest $request)
 {
     /**
      * Unpack the request for clarity
      * to readers of the source code.
      */
     $get_asset = $request->get_asset;
     $get_quantity = (int) toSatoshi($request->get_quantity);
     $give_asset = $request->give_asset;
     $give_quantity = (int) toSatoshi($request->give_quantity);
     $source = $request->source;
     $expiration = (int) $request->expiration;
     /**
      * get_pubkey_for_address returns none
      * for addresses that aren't used yet.
      *
      * So, I use it to do basic validation.
      */
     if ($pubkey = $this->counterblock->execute('get_pubkey_for_address', ['address' => $source])) {
         /**
          * A source address should have enough
          * BTC for fees around 10,000 satoshis.
          */
         if ($this->guardAgainstInsufficientBitcoinBalance($source)) {
             return redirect()->route('order')->withInput()->with('warning', 'Insufficient BTC at this address. At least 0.0001 BTC is required for fees.');
         }
         /**
          * A source address should have enough
          * give_asset for filling their order.
          */
         if ($this->guardAgainstInsufficientAssetBalance($source, $give_asset, $give_quantity)) {
             $give_quantity = unSatoshi($give_quantity);
             return redirect()->route('order')->withInput()->with('warning', "Insufficient {$give_asset} at this address. At least {$give_quantity} is required.");
         }
         /**
          * The source address has the funds.
          * This creates an unsigned raw tx.
          */
         $orderHex = $this->counterparty->execute('create_order', ['source' => $source, 'pubkey' => $pubkey, 'give_asset' => $give_asset, 'give_quantity' => $give_quantity, 'get_asset' => $get_asset, 'get_quantity' => $get_quantity, 'expiration' => $expiration, 'allow_unconfirmed_inputs' => true, 'fee_required' => 0]);
         /**
          * Send user to success page so they
          * can receive their raw tx hex code.
          */
         return redirect()->route('order::result')->withInput()->with('success', $orderHex);
     }
     /**
      * Unknown Address / Result
      */
     return redirect()->route('order')->withInput()->with('warning', "Your address: {$source} does not appear to be actively used.");
 }
Ejemplo n.º 2
0
    }
    $content .= "<br /><br />";
    // Total Stats
    $TotalClaims = $mysqli->query("SELECT COUNT(id) FROM faucet_transactions WHERE type = 'Payout' AND userid = '{$user['id']}'")->fetch_row()[0];
    $TotalClaimed = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Payout' AND userid = '{$user['id']}'")->fetch_row()[0];
    $TotalClaimed = $TotalClaimed ? $TotalClaimed : 0;
    // 24 Hours stats
    $Last24Hours = time() - 86400;
    $Last24HoursClaims = $mysqli->query("SELECT COUNT(id) FROM faucet_transactions WHERE type = 'Payout' AND userid = '{$user['id']}' AND timestamp > '{$Last24Hours}'")->fetch_row()[0];
    $Last24HoursClaimed = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Payout' AND userid = '{$user['id']}' AND timestamp > '{$Last24Hours}'")->fetch_row()[0];
    $Last24HoursClaimed = $Last24HoursClaimed ? $Last24HoursClaimed : 0;
    // Referral
    $TotalReferralPayout = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Referral' AND userid = '{$user['id']}'")->fetch_row()[0];
    $TotalReferralPayout = $TotalReferralPayout ? $TotalReferralPayout : 0;
    $Last24HoursReferralPayout = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Referral' AND userid = '{$user['id']}' AND timestamp > '{$Last24Hours}'")->fetch_row()[0];
    $Last24HoursReferralPayout = $Last24HoursReferralPayout ? $Last24HoursReferralPayout : 0;
    $content .= "<h3>Stats</h3>\n\t<div class='row'>\n\t<div class='col-md-12'>\n\t\t<h3>All time</h3>\n\t</div>\n\t<div class='col-md-4'>\n\t\t<h4>Total Claims</h4>\n\t\t<b>" . $TotalClaims . "</b>\n\t</div>\n\t<div class='col-md-4'>\n\t\t<h4>Total Claimed</h4>\n\t\t<b>" . toSatoshi($TotalClaimed) . "</b><br />Satoshi\n\t</div>\n\t<div class='col-md-4'>\n\t\t<h4>Total Referral Payout</h4>\n\t\t<b>" . toSatoshi($TotalReferralPayout) . "</b><br />Satoshi\n\t</div>\n\t<div class='col-md-12'>\n\t\t<h3>Last 24 Hours</h3>\n\t</div>\n\t<div class='col-md-4'>\n\t\t<h4>Claims</h4>\n\t\t<b>" . $Last24HoursClaims . "</b>\n\t</div>\n\t<div class='col-md-4'>\n\t\t<h4>Claimed</h4>\n\t\t<b>" . toSatoshi($Last24HoursClaimed) . "</b><br />Satoshi\n\t</div>\n\t<div class='col-md-4'>\n\t\t<h4>Total Referral Payout</h4>\n\t\t<b>" . toSatoshi($Last24HoursReferralPayout) . "</b><br />Satoshi\n\t</div>\n\t</div>";
    $headTable = "<h3>Last 15 Transactions</h3><center><table class='table' style='text-align: center; width: 400px;'border='0' cellpadding='2' cellspacing='2'>\n\t  <thead>\n\t    <tr>\n\t      <td>Type</td>\n\t      <td>Time</td>\n\t      <td>Amount</td>\n\t    </tr>\n\t    </thead>";
    $bodyTable = "<tbody>";
    $UserTransactions = $mysqli->query("SELECT * FROM faucet_transactions WHERE userid = '{$user['id']}' ORDER BY id DESC LIMIT 15");
    while ($Tx = $UserTransactions->fetch_assoc()) {
        $bodyTable .= "<tr>\n\t\t\t\t\t\t<td>" . $Tx['type'] . "</td>\n\t\t\t\t\t\t<td>" . findTimeAgo($Tx['timestamp']) . "</td>\n\t\t\t\t\t\t<td>" . $Tx['amount'] . "</td>\n\t\t\t\t\t</tr>";
    }
    $footerTable = "</tbody></table></center>";
    $content .= $headTable . $bodyTable . $footerTable;
} else {
    header("Location: index.php");
    exit;
}
$tpl->assign("content", $content);
$tpl->display();
Ejemplo n.º 3
0
 default:
     // Total Stats
     $TotalClaims = $mysqli->query("SELECT COUNT(id) FROM faucet_transactions WHERE type = 'Payout'")->fetch_row()[0];
     $TotalClaimed = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Payout'")->fetch_row()[0];
     $TotalClaimed = $TotalClaimed ? $TotalClaimed : 0;
     // 24 Hours stats
     $Last24Hours = time() - 86400;
     $Last24HoursClaims = $mysqli->query("SELECT COUNT(id) FROM faucet_transactions WHERE type = 'Payout' AND timestamp > '{$Last24Hours}'")->fetch_row()[0];
     $Last24HoursClaimed = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Payout' AND timestamp > '{$Last24Hours}'")->fetch_row()[0];
     $Last24HoursClaimed = $Last24HoursClaimed ? $Last24HoursClaimed : 0;
     // Referral
     $TotalReferralPayout = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Referral'")->fetch_row()[0];
     $TotalReferralPayout = $TotalReferralPayout ? $TotalReferralPayout : 0;
     $Last24HoursReferralPayout = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Referral' AND timestamp > '{$Last24Hours}'")->fetch_row()[0];
     $Last24HoursReferralPayout = $Last24HoursReferralPayout ? $Last24HoursReferralPayout : 0;
     $content .= "<h2>Stats</h2>\n\t\t<div class='row'>\n\t\t<div class='col-md-12'>\n\t\t\t<h3>All time</h3>\n\t\t</div>\n\t\t<div class='col-md-4'>\n\t\t\t<h4>Total Claims</h4>\n\t\t\t<b>" . $TotalClaims . "</b>\n\t\t</div>\n\t\t<div class='col-md-4'>\n\t\t\t<h4>Total Claimed</h4>\n\t\t\t<b>" . toSatoshi($TotalClaimed) . "</b><br />Satoshi\n\t\t</div>\n\t\t<div class='col-md-4'>\n\t\t\t<h4>Total Referral Payout</h4>\n\t\t\t<b>" . toSatoshi($TotalReferralPayout) . "</b><br />Satoshi\n\t\t</div>\n\t\t<div class='col-md-12'>\n\t\t\t<h3>Last 24 Hours</h3>\n\t\t</div>\n\t\t<div class='col-md-4'>\n\t\t\t<h4>Claims</h4>\n\t\t\t<b>" . $Last24HoursClaims . "</b>\n\t\t</div>\n\t\t<div class='col-md-4'>\n\t\t\t<h4>Claimed</h4>\n\t\t\t<b>" . toSatoshi($Last24HoursClaimed) . "</b><br />Satoshi\n\t\t</div>\n\t\t<div class='col-md-4'>\n\t\t\t<h4>Referral Payout</h4>\n\t\t\t<b>" . toSatoshi($Last24HoursReferralPayout) . "</b><br />Satoshi\n\t\t</div>\n\t\t</div><br /><h2>Configuration</h2>\n\t\t<a class='btn btn-default' href='?p=as'>Standard settings</a><br />\n\t\t<a class='btn btn-default' href='?p=ps'>Page settings</a><br />\n\t\t<a class='btn btn-default' href='?p=ads'>Advertising settings</a><br />\n\n\t\t<hr />\n\n\t\t<a class='btn btn-info' href='?p=bip'>Ban IPs</a><br />\n\t\t<a class='btn btn-info' href='?p=bad'>Ban Address</a><br />";
     break;
 case "as":
     $content .= "<a href='admin.php'>Back</a><br>\n\t\t<h3>Admin Settings</h3><h4>Change Admin login datas</h4>";
     $Username = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '12' LIMIT 1")->fetch_assoc()['value'];
     if ($_GET['c'] == 1) {
         if (isset($_POST['username']) and isset($_POST['password'])) {
             if ($_POST['username'] and $_POST['password']) {
                 $username = $mysqli->real_escape_string($_POST['username']);
                 $password = $mysqli->real_escape_string(hash("sha256", $_POST['password']));
                 $mysqli->query("UPDATE faucet_settings Set value = '{$username}' WHERE id = '12'");
                 $mysqli->query("UPDATE faucet_settings Set value = '{$password}' WHERE id = '13'");
                 $content .= alert("success", "Username and Password was changed successfully.");
             } else {
                 if ($_POST['username']) {
                     $content .= alert("danger", "Please fill all forms.");
Ejemplo n.º 4
0
<?php

include "includes/core.php";
$content = "";
if ($user) {
    $content .= "<h3>Address</h3>";
    $content .= $user['address'];
    $content .= "<h3>Balance</h3>";
    $content .= toSatoshi($user['balance']) . " Satoshi<br /><br />";
    $content .= "<a href='account.php' class='btn btn-primary'>Account/Stats/Withdraw</a><br /><br />";
    $claimStatus = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '11' LIMIT 1")->fetch_assoc()['value'];
    if ($claimStatus == "yes") {
        $timer = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '5' LIMIT 1")->fetch_assoc()['value'];
        $minReward = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '6' LIMIT 1")->fetch_assoc()['value'];
        $maxReward = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '7' LIMIT 1")->fetch_assoc()['value'];
        $content .= alert("success", "<span class='glyphicon glyphicon-info-sign' aria-hidden='true'></span> Rewards: " . $minReward . " to " . $maxReward . " Satoshi every " . $timer . " minutes");
        $nextClaim = $user['last_claim'] + $timer * 60;
        if (time() >= $nextClaim) {
            if ($user['claim_cryptokey'] == "") {
                $cryptoGenNumber = rand(1, 256);
                $cryptoKey = hash('sha256', "Key_" . $user['address'] . time() . $cryptoGenNumber);
                $mysqli->query("UPDATE faucet_user_list Set claim_cryptokey = '{$cryptoKey}' WHERE id = '{$user['id']}'");
                header("Location: index.php");
                exit;
            }
            if ($_GET['c'] != "1") {
                $content .= "\n\t\t<h1>1. Claim</h1><br />\n\t\t<form method='post' action='verify.php'>\n\t\t<input type='hidden' name='verifykey' value='" . $user['claim_cryptokey'] . "'/>\n\t\t<input type='hidden' name='token' value='" . $_SESSION['token'] . "'/>\n\t\t<button type='submit' class='btn btn-success btn-lg'><span class='glyphicon glyphicon-menu-right' aria-hidden='true'></span> Next</button>\n\t\t</form>";
            } else {
                if ($_GET['c'] == "1") {
                    if ($_POST['verifykey'] == $user['claim_cryptokey']) {
                        $mysqli->query("UPDATE faucet_user_list Set claim_cryptokey = '' WHERE id = '{$user['id']}'");