function _checkDeposits()
{
    $init = true;
    include __DIR__ . '/db-conf.php';
    include __DIR__ . '/wallet_driver.php';
    mysql_query("UPDATE `system` SET `deposits_last_round`=NOW() WHERE `id`=1 LIMIT 1");
    $settings = mysql_fetch_array(mysql_query("SELECT * FROM `system` WHERE `id`=1 LIMIT 1"));
    $deposits = mysql_query("SELECT * FROM `deposits`");
    while ($dp = mysql_fetch_array($deposits)) {
        $received = 0;
        $txid = '';
        $txs = walletRequest('listtransactions', array('', 1000));
        $txs = array_reverse($txs);
        foreach ($txs as $tx) {
            if ($tx['category'] != 'receive') {
                continue;
            }
            if ($tx['address'] != $dp['address']) {
                continue;
            }
            $received = $tx['amount'];
            break;
        }
        if ($received < $settings['min_deposit']) {
            continue;
        }
        $txid = $tx['txid'] == '' ? '[unknown]' : $tx['txid'];
        if ($dp['received'] == 1) {
            if ($tx['confirmations'] >= $settings['min_confirmations']) {
                $delExed = false;
                do {
                    $delExed = mysql_query("DELETE FROM `deposits` WHERE `id`={$dp['id']} LIMIT 1");
                } while ($delExed == false);
                if ($delExed == true) {
                    if (mysql_num_rows(mysql_query("SELECT `id` FROM `transactions` WHERE `txid`='{$dp['txid']}' AND `txid`!='[unknown]' LIMIT 1")) != 0) {
                        continue;
                    }
                    mysql_query("UPDATE `players` SET `balance`=TRUNCATE(ROUND((`balance`+{$received}),9),8) WHERE `id`={$dp['player_id']} LIMIT 1");
                    mysql_query("INSERT INTO `transactions` (`player_id`,`amount`,`txid`) VALUES ({$dp['player_id']},{$dp['amount']},'{$dp['txid']}')");
                }
            }
            continue;
        }
        mysql_query("UPDATE `deposits` SET `received`=1,`amount`={$received},`txid`='{$txid}' WHERE `id`={$dp['id']} LIMIT 1");
    }
    mysql_query("DELETE FROM `deposits` WHERE `time_generated`<NOW()-INTERVAL 7 DAY");
}
Esempio n. 2
0
                    echo '<div class="zpravared"><b>Error:</b> ' . $settings['currency'] . ' address is not valid.</div>';
                }
            } else {
                echo '<div class="zpravared"><b>Error:</b> ' . $settings['currency'] . ' address is not valid.</div>';
            }
        } else {
            echo '<div class="zpravared"><b>Error:</b> Amount is not numeric.</div>';
        }
    }
    ?>
  <h1>Wallet</h1>
  <div class="zprava">
  <b>Receiving address:</b><br>
  <big>
  <?php 
    echo walletRequest('getnewaddress');
    ?>
  </big>
  </div>
  
  <div class="zprava">
    <b>Withdraw:</b><br>
    <form action="./?p=wallet" method="post">
      Amount: <input type="text" name="_am"> <?php 
    echo $settings['currency_sign'];
    ?>
 address: <input type="text" name="_adr"> <input type="submit" value="Withdraw">
    </form>
  </div>
  <div class="zprava">
    <table style="border: 0; border-collapse: collapse;">
Esempio n. 3
0
*/
header('X-Frame-Options: DENY');
$init = true;
include '../../inc/db-conf.php';
include '../../inc/wallet_driver.php';
include '../../inc/functions.php';
if (empty($_GET['_unique']) || mysql_num_rows(mysql_query("SELECT `id` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1")) == 0) {
    exit;
}
$settings = mysql_fetch_array(mysql_query("SELECT * FROM `system` WHERE `id`=1 LIMIT 1"));
if (empty($_GET['wager']) || (double) $_GET['wager'] < 0) {
    $wager = 0;
} else {
    $wager = (double) $_GET['wager'];
}
$wbalance = walletRequest('getbalance');
$max_wager = (double) $wbalance / $settings['bankroll_maxbet_ratio'];
if ($wager > $max_wager) {
    echo json_encode(array('error' => 'yes', 'content' => 'too_big'));
    exit;
}
$player = mysql_fetch_array(mysql_query("SELECT * FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1"));
validateAccess($player['id']);
if (mysql_num_rows(mysql_query("SELECT `id` FROM `games` WHERE `player`={$player['id']} AND `ended`=0 LIMIT 1")) != 0) {
    echo json_encode(array('error' => 'yes', 'content' => 'playing'));
    exit;
}
if ($wager > $player['balance']) {
    echo json_encode(array('error' => 'yes', 'content' => 'balance'));
    exit;
}
Esempio n. 4
0
*/
header('X-Frame-Options: DENY');
$init = true;
include '../../inc/db-conf.php';
include '../../inc/wallet_driver.php';
include '../../inc/functions.php';
if (empty($_GET['_unique']) || mysql_num_rows(mysql_query("SELECT `id` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1")) == 0) {
    exit;
}
$player = mysql_fetch_array(mysql_query("SELECT `id`,`balance` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1"));
validateAccess($player['id']);
$validate = walletRequest('validateaddress', array($_GET['valid_addr']));
if ($validate['isvalid'] == false) {
    $error = 'yes';
    $con = 'Address is not valid.';
} else {
    $player = mysql_fetch_array(mysql_query("SELECT `id`,`balance` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1"));
    if (!is_numeric($_GET['amount']) || (double) $_GET['amount'] > $player['balance'] || (double) $_GET['amount'] < $settings['min_withdrawal']) {
        $error = 'yes';
        $con = 'You have insufficient funds.';
    } else {
        $amount = (double) $_GET['amount'];
        mysql_query("UPDATE `players` SET `balance`=TRUNCATE(ROUND((`balance`-{$amount}),9),8) WHERE `id`={$player['id']} LIMIT 1");
        $txid = walletRequest('sendtoaddress', array($_GET['valid_addr'], $amount));
        mysql_query("INSERT INTO `transactions` (`player_id`,`amount`,`txid`) VALUES ({$player['id']},(0-{$amount}),'{$txid}')");
        $error = 'no';
        $con = $txid;
    }
}
$return = array('error' => $error, 'content' => $con);
echo json_encode($return);
Esempio n. 5
0
<?php

/*
 *  © CryptoBlackJack
 *  
 *  
 *  
*/
header('X-Frame-Options: DENY');
$init = true;
include '../../inc/db-conf.php';
include '../../inc/wallet_driver.php';
include '../../inc/functions.php';
if (empty($_GET['_unique']) || mysql_num_rows(mysql_query("SELECT `id` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1")) == 0) {
    exit;
}
$player = mysql_fetch_array(mysql_query("SELECT `id` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1"));
validateAccess($player['id']);
$new_addr = walletRequest('getnewaddress');
mysql_query("INSERT INTO `deposits` (`player_id`,`address`) VALUES ({$player['id']},'{$new_addr}')");
echo json_encode(array('confirmed' => $new_addr));
<?php

/*
 *  © CryptoBlackJack
 *  
 *  
 *  
*/
include __DIR__ . '/driver_test.php';
$test = walletRequest('getinfo', 'http://' . $_GET['w_user'] . ':' . $_GET['w_pass'] . '@' . $_GET['w_host'] . ':' . $_GET['w_port'] . '/');
if ($test === null) {
    echo json_encode(array('error' => 'yes'));
} else {
    echo json_encode(array('error' => 'no'));
}
Esempio n. 7
0
"></td>
    </tr>
    <tr>
      <td>Minimal withdrawal:</td>
      <td><input type="text" name="min_withdrawal" value="<?php 
echo $settings['min_withdrawal'];
?>
"> <?php 
echo $settings['currency_sign'];
?>
</td>
    </tr>
    <tr>
      <td>Transaction fee:</td>
      <td><input type="text" name="txfee" value="<?php 
$infofee = walletRequest('getinfo');
echo $infofee['paytxfee'];
?>
"> <?php 
echo $settings['currency_sign'];
?>
</td>
      <td><small><i>Transaction fee to <?php 
echo $settings['currency'];
?>
 network.</i></small></td>
    </tr>
    <tr>
      <td>Bankroll/max bet ratio</td>
      <td><input type="text" name="bankroll_maxbet_ratio" value="<?php 
echo $settings['bankroll_maxbet_ratio'];
Esempio n. 8
0
<?php

/*
 *  © CryptoBlackJack
 *  
 *  
 *  
*/
if (isset($included) && $logged == true) {
    if (!empty($_POST['s_title']) && !empty($_POST['s_url']) && !empty($_POST['s_desc']) && !empty($_POST['cur']) && !empty($_POST['cur_s']) && isset($_POST['min_withdrawal']) && is_numeric((double) $_POST['min_withdrawal']) && isset($_POST['bj_pays']) && is_numeric((int) $_POST['bj_pays']) && isset($_POST['hits_on_soft']) && is_numeric((int) $_POST['hits_on_soft']) && isset($_POST['number_of_decks']) && is_numeric((int) $_POST['number_of_decks']) && isset($_POST['min_confirmations']) && is_numeric((int) $_POST['min_confirmations']) && isset($_POST['min_deposit']) && is_numeric((double) $_POST['min_deposit']) && isset($_POST['txfee']) && is_numeric((double) $_POST['txfee']) && isset($_POST['bankroll_maxbet_ratio']) && is_numeric((double) $_POST['bankroll_maxbet_ratio'])) {
        mysql_query("UPDATE `system` SET `title`='" . prot($_POST['s_title']) . "',`url`='" . prot($_POST['s_url']) . "',`currency`='" . prot($_POST['cur']) . "',`min_withdrawal`=" . (double) $_POST['min_withdrawal'] . ",`min_confirmations`=" . (int) $_POST['min_confirmations'] . ",`min_deposit`=" . (double) $_POST['min_deposit'] . ",`currency_sign`='" . prot($_POST['cur_s']) . "',`description`='" . prot($_POST['s_desc']) . "',`bankroll_maxbet_ratio`=" . (double) $_POST['bankroll_maxbet_ratio'] . ",`number_of_decks`=" . (int) $_POST['number_of_decks'] . ",`hits_on_soft`=" . (int) $_POST['hits_on_soft'] . ",`bj_pays`=" . (int) $_POST['bj_pays'] . " WHERE `id`=1 LIMIT 1");
        walletRequest('settxfee', array(round((double) $_POST['txfee'], 8)));
        $warnStatus = '<div class="zpravagreen"><b>Success!</b> Data was successfuly saved.</div>';
    } else {
        if (isset($_POST['s_title'])) {
            $warnStatus = '<div class="zpravared"><b>Error!</b> One of fields is empty.</div>';
        }
    }
    if (isset($_POST['addons_form'])) {
        $giveaway = isset($_POST['giveaway']) ? 1 : 0;
        $chat_enable = isset($_POST['chat_enable']) ? 1 : 0;
        mysql_query("UPDATE `system` SET `giveaway`={$giveaway},`giveaway_amount`=" . (double) $_POST['giveaway_amount'] . ",`giveaway_freq`=" . (int) $_POST['giveaway_freq'] . ",`chat_enable`={$chat_enable} LIMIT 1");
    }
}