Exemple #1
11
if (!securePage($_SERVER['PHP_SELF'])) {
    die;
}
require_once "models/header.php";
require_once "models/cryptofunctions.php";
if ($_POST['submit'] == "Withdraw Doge") {
    if ($_POST['withdrawdogeamount'] > get_balance($loggedInUser->user_id, "DOGE")) {
        $error = "You cannot withdraw more than you have!";
    }
    $result = withdraw($loggedInUser->user_id, 'doge', $_POST['withdrawdogeamount']);
} else {
    if ($_POST['submit'] == "Withdraw BTC") {
        if ($_POST['withdrawbtcamount'] > get_balance($loggedInUser->user_id, "BTC")) {
            $error = "You cannot withdraw more than you have!";
        }
        $result = withdraw($loggedInUser->user_id, 'btc', $_POST['withdrawbtcamount']);
    } else {
    }
}
?>

<div class='container container_12'>
	<?php 
if ($result) {
    ?>
<div class="notice">Withdraw succeeded with transaction id: <?php 
    echo $result;
    ?>
</div><?php 
} else {
    if ($error) {
Exemple #2
0
$is = mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$userid}", $c) or die(mysql_error());
$ir = mysql_fetch_array($is);
check_level();
$fm = money_formatter($ir['money']);
$cm = money_formatter($ir['crystals'], '');
$lv = date('F j, Y, g:i a', $ir['laston']);
$h->userdata($ir, $lv, $fm, $cm);
$h->menuarea();
print "<h3>Bank</h3>";
if ($ir['bankmoney'] > -1) {
    switch ($_GET['action']) {
        case "deposit":
            deposit();
            break;
        case "withdraw":
            withdraw();
            break;
        default:
            index();
            break;
    }
} else {
    if (isset($_GET['buy'])) {
        if ($ir['money'] > 49999) {
            print "Congratulations, you bought a bank account for \$50,000!<br />\n<a href='bank.php'>Start using my account</a>";
            mysql_query("UPDATE users SET money=money-50000,bankmoney=0 WHERE userid={$userid}", $c);
        } else {
            print "You do not have enough money to open an account.\n<a href='explore.php'>Back to town...</a>";
        }
    } else {
        print "Open a bank account today, just \$50,000!<br />\n<a href='bank.php?buy'>&gt; Yes, sign me up!</a>";
function auto_withdraw($currency)
{
    global $mysqli, $db_table_prefix, $errors;
    $query = "Select userid, {$currency}_last_balance, {$currency}address, currency from uc_users INNER JOIN user_receive_address ON uc_users.id = user_receive_address.userid where auto{$currency} = 1";
    $stmtwithdraw = $mysqli->prepare($query);
    $stmtwithdraw->execute();
    $stmtwithdraw->bind_result($userid, $balance, $address, $fiatcurrency);
    $count = 0;
    if ($currency == 'doge') {
        $min = 100;
        $reserve = 50;
    } else {
        if ($currency == 'btc') {
            $min = 0.005;
            $reserve = 0.001;
        }
    }
    while ($stmtwithdraw->fetch()) {
        $withdraws[$count]['userid'] = $userid;
        $withdraws[$count]['balance'] = $balance;
        $withdraws[$count]['address'] = $address;
        $withdraws[$count]['fiatcurrency'] = $fiatcurrency;
        $count++;
    }
    $stmtwithdraw->close();
    foreach ($withdraws as $w) {
        echo "\r\n===";
        if ($realbalance = get_balance($w['userid'], $currency)) {
            if ($realbalance > $min) {
                echo "{balance for " . $w['userid'] . " is" . $realbalance . "}";
                withdraw($w['userid'], $currency, $realbalance - $reserve, $w['address'], $w['fiatcurrency']);
                echo "withdraw";
            }
        }
    }
    echo "done";
}