Esempio n. 1
0
<?php

require_once '../util.php';
$is_logged_in = 'sync_to_bitcoin';
foreach (bitcoin_list_accounts(CONFIRMATIONS_FOR_DEPOSIT) as $account => $balance) {
    if ($balance) {
        try {
            get_openid_for_user($account);
            // check they have an account
        } catch (Exception $e) {
            continue;
        }
        get_user_lock($account);
        addlog(LOG_CRONJOB, sprintf("add %s BTC for user %s", internal_to_numstr($balance), $account));
        sync_to_bitcoin((string) $account);
        release_lock($account);
    }
}
Esempio n. 2
0
function has_enough($amount, $curr_type)
{
    $uid = user_id();
    sync_to_bitcoin($uid);
    $query = "\n        SELECT 1\n        FROM purses\n        WHERE uid='{$uid}' AND type='{$curr_type}' AND amount >= '{$amount}'\n        LIMIT 1;\n    ";
    $result = do_query($query);
    return has_results($result);
}
Esempio n. 3
0
<?php

require_once '../util.php';
if (count($argv) < 2) {
    echo "need account name to synchronise\n";
    exit(-1);
}
$uid = cleanup_string($argv[1]);
# check they actually exist
$query = "SELECT 1 FROM users WHERE uid='{$uid}'";
$result = do_query($query);
if (has_results($result)) {
    sync_to_bitcoin($uid);
    echo "Done.\n";
} else {
    echo "User {$uid} doesn't exist.\n";
}