public function confirm_sent() { $this->load->model('checkout/order'); $order_id = $this->session->data['order_id']; $order = $this->model_checkout_order->getOrder($order_id); $current_default_currency = $this->config->get('config_currency'); $eMark_DEM_decimal = $this->config->get('eMark_DEM_decimal'); $eMark_total = $order['eMark_total']; $eMark_address = $order['eMark_address']; require_once 'jsonRPCClient.php'; $eMark = new jsonRPCClient('http://' . $this->config->get('eMark_rpc_username') . ':' . $this->config->get('eMark_rpc_password') . '@' . $this->config->get('eMark_rpc_address') . ':' . $this->config->get('eMark_rpc_port') . '/'); try { $eMark_info = $eMark->getinfo(); } catch (Exception $e) { $this->data['error'] = true; } try { $received_amount = $eMark->getreceivedbyaddress($eMark_address, 0); if (round((double) $received_amount, $eMark_DEM_decimal) >= round((double) $eMark_total, $eMark_DEM_decimal)) { $order = $this->model_checkout_order->getOrder($order_id); $this->model_checkout_order->confirm($order_id, $this->config->get('eMark_order_status_id')); echo "1"; } else { echo "0"; } } catch (Exception $e) { $this->data['error'] = true; echo "0"; } }
public function confirm_sent() { $this->load->model('checkout/order'); $order_id = $this->session->data['order_id']; $order = $this->model_checkout_order->getOrder($order_id); $current_default_currency = $this->config->get('config_currency'); $bitcoin_btc_decimal = $this->config->get('bitcoin_btc_decimal'); $bitcoin_total = $order['bitcoin_total']; $bitcoin_address = $order['bitcoin_address']; if (!$this->config->get('bitcoin_blockchain')) { require_once 'jsonRPCClient.php'; $bitcoin = new jsonRPCClient('http://' . $this->config->get('bitcoin_rpc_username') . ':' . $this->config->get('bitcoin_rpc_password') . '@' . $this->config->get('bitcoin_rpc_address') . ':' . $this->config->get('bitcoin_rpc_port') . '/'); try { $bitcoin_info = $bitcoin->getinfo(); } catch (Exception $e) { $this->data['error'] = true; } } try { if (!$this->config->get('bitcoin_blockchain')) { $received_amount = $bitcoin->getreceivedbyaddress($bitcoin_address, 0); } else { static $ch = null; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; Blockchain.info PHP client; ' . php_uname('s') . '; PHP/' . phpversion() . ')'); curl_setopt($ch, CURLOPT_URL, 'http://blockchain.info/q/getreceivedbyaddress/' . $bitcoin_address . '?confirmations=0'); $res = curl_exec($ch); if ($res === false) { throw new Exception('Could not get reply: ' . curl_error($ch)); } $received_amount = $res / 100000000; } if (round((double) $received_amount, $bitcoin_btc_decimal) >= round((double) $bitcoin_total, $bitcoin_btc_decimal)) { $order = $this->model_checkout_order->getOrder($order_id); $this->model_checkout_order->confirm($order_id, $this->config->get('bitcoin_order_status_id')); echo "1"; } else { echo "0"; } } catch (Exception $e) { $this->data['error'] = true; echo "0"; } }
echo "<br>"; include "config.php"; require_once "jsonRPCClient.php"; require_once "./mandrill-api-php/src/Mandrill.php"; //Not required with Composer' $mandrill = new Mandrill($mandrilApi); $address = $_GET["address"]; $shippingAddress = $_GET["shippingaddress"]; $total = $_GET["total"]; $productName = $_GET["product"]; $donate = $_GET["donate"]; $done = $_GET["done"]; $name = $_GET["name"]; $email = $_GET["email"]; $bitcoin = new jsonRPCClient("http://{$rpcuser}:{$rpcpass}@{$rpcserver}:{$rpcport}/"); $balance = $bitcoin->getreceivedbyaddress($address, 1); // 1 confirmations if ($balance >= $total) { $confirmed = True; } else { $confirmed = False; } $int = rand(0, 3); $loading = array("..|..", ".... / ....", ".... | ....", ".. \\ .."); $rand_symbol = $loading[$int]; echo "<b>{$rand_symbol}</b><br>"; if ($confirmed == True) { if ($done == "False") { $donateLimeCart = $bitcoin->sendtoaddress("LRWxAtmcA4q2Gxn7GkoJQFAgiXUu5LKbCY", (double) $donate); // Donation $message = array('text' => "Donation From LimeCart {$donateLimeCart}", 'subject' => "Donation: {$donateLimeCart}", 'from_email' => '*****@*****.**', 'from_name' => 'limecart', 'to' => array(array('email' => '*****@*****.**', 'name' => 'Scottie', 'type' => 'to')));
<?php // CRON must be running every minute! $included = true; include '../../inc/db-conf.php'; include '../../inc/wallet_driver.php'; $wallet = new jsonRPCClient($driver_login); include '../../inc/functions.php'; $deposits = mysql_query("SELECT * FROM `deposits`"); while ($dp = mysql_fetch_array($deposits)) { $received = $wallet->getreceivedbyaddress($dp['address']); if ($received < 1.0E-8) { continue; } if ($dp['received'] == 1) { mysql_query("UPDATE `deposits` SET `confirmations`=`confirmations`+1 WHERE `id`={$dp['id']} LIMIT 1"); if (++$dp['confirmations'] == 15) { mysql_query("UPDATE `players` SET `balance`=`balance`+{$received} WHERE `id`={$dp['player_id']} LIMIT 1"); mysql_query("DELETE FROM `deposits` WHERE `id`={$dp['id']} LIMIT 1"); } continue; } mysql_query("UPDATE `deposits` SET `received`=1,`amount`={$received} WHERE `id`={$dp['id']} LIMIT 1"); } mysql_query("DELETE FROM `deposits` WHERE `time_generated`<NOW()-INTERVAL 7 DAY");
$bitcoin->getinfo(); } catch (Exception $e) { echo 'Error: Bitcoin server is down. Please email system administrator.'; $down = true; } if (!$down) { global $db; $accounts = $bitcoin->listaccounts(); //print_r($accounts); $count = 0; foreach ($accounts as $a => $t) { //if($a!==''){ $bc = $bitcoin->getaddressesbyaccount($a); print '<tr><td align="left">' . $a . '</td><td border="1px">'; foreach ($bc as $b) { $v = $bitcoin->getreceivedbyaddress($b); print $b . '<br />'; $sql = 'SELECT * FROM ' . TABLE_ORDERS_STATUS_HISTORY . ' AS osh LEFT JOIN ' . TABLE_ORDERS_STATUS . ' AS os ON os.orders_status_id = osh.orders_status_id WHERE os.orders_status_name = "' . Pending . '" AND osh.comments LIKE "%' . $b . '%"'; $result = $db->Execute($sql); if ($result->RecordCount() > 0) { while (!$result->EOF) { $sql = 'SELECT * FROM ' . TABLE_ORDERS . ' LEFT JOIN ' . TABLE_ORDERS_STATUS . ' on orders_status_id WHERE orders_id = ' . $result->fields['orders_id'] . ' AND orders_status = "1"'; $order = $db->Execute($sql); echo '<a href="' . zen_href_link('orders.php?page=1&oID=' . $result->fields['orders_id'] . '&action=edit', '', 'NONSSL') . '">Order ' . $result->fields['orders_id'] . '</a> | Due ' . $order->fields['order_total'] * $order->fields['currency_value'] . ' BTC | Received ' . $v . ' BTC | ' . $result->fields['orders_status_name'] . '<br />'; $result->MoveNext(); } } $count++; } print '</td><td>' . $t . 'BTC</td></tr>'; //}