if ($num_rows != 1) { if (!mysql_query("INSERT INTO transactions (id,date,username,action,coin,address,txid,amount) VALUES ('','{$DEPOSIT_date}','{$user_session}','{$DEPOSIT_tx_type}','{$DEPOSIT_coin_type}','{$DEPOSIT_address}','{$DEPOSIT_txid}','{$DEPOSIT_amount}')")) { die("Server error"); } else { $result = plusfunds($user_session, "BTE", $DEPOSIT_amount); if ($result) { $r_system_action = "success"; } else { die("Server error"); } } } } } } $Chncoind_List_Transactions = $Chncoind->listtransactions($wallet_id, 50); foreach ($Chncoind_List_Transactions as $Chncoind_List_Transaction) { if ($Chncoind_List_Transaction['category'] == "receive") { if (6 <= $Chncoind_List_Transaction['confirmations']) { $DEPOSIT_tx_type = 'deposit'; $DEPOSIT_coin_type = "LTC"; $DEPOSIT_date = date('n/j/y h:i a', $Chncoind_List_Transaction['time']); $DEPOSIT_address = $Chncoind_List_Transaction['address']; $DEPOSIT_amount = abs($Chncoind_List_Transaction['amount']); $DEPOSIT_txid = $Chncoind_List_Transaction['txid']; $SQL = "SELECT * FROM transactions WHERE coin='{$DEPOSIT_coin_type}' and txid='{$DEPOSIT_txid}'"; $result = mysql_query($SQL); $num_rows = mysql_num_rows($result); if ($num_rows != 1) { if (!mysql_query("INSERT INTO transactions (id,date,username,action,coin,address,txid,amount) VALUES ('','{$DEPOSIT_date}','{$user_session}','{$DEPOSIT_tx_type}','{$DEPOSIT_coin_type}','{$DEPOSIT_address}','{$DEPOSIT_txid}','{$DEPOSIT_amount}')")) { die("Server error");
<?php /* * © BitcoinDice */ // 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 = 0; $txid = ''; $txs = $wallet->listtransactions('', 2000); $txs = array_reverse($txs); foreach ($txs as $tx) { if ($tx['category'] != 'receive') { continue; } if ($tx['confirmations'] < 1) { continue; } if ($tx['address'] != $dp['address']) { continue; } $received = $tx['amount']; $txid = $tx['txid']; break; }
die("Module Not Activated"); } if ($_GET['test']) { die("Test mode not allowed."); } $rpc = "http://{$gateway['username']}:{$gateway['password']}@{$gateway['host']}:{$gateway['port']}"; # Build Litecoin Information Here require_once '../whmcscoin/jsonRPCClient.php'; $litecoin = new jsonRPCClient($rpc); if (!$litecoin->getinfo()) { die('could not connect to litecoind'); } while ($result = mysql_fetch_array(select_query('tblinvoices', 'id,amount', array('paymentmethod' => $gatewaymodule, 'status' => 'Unpaid'), 'id', 'DESC'))) { $ltc_info = mysql_fetch_array(select_query("mod_gw_litecoin_info", "secret", array("invoice_id" => $result['id']), "invoice_id", "DESC", 1)); $amount = $result['amount']; $received = $litecoin->listtransactions($ltc_info['secret'], 1000); # I feel like we can do better than just get the LAST ONE THOUSAND TRANSACTIONS but we'll figure that out later foreach ($received as $recArr) { # Let's be sure we're RECEIVING this transaction. if ($recArr['category'] != 'receive') { continue; } # Transaction ID already in the DB? # We might should change this later. $txCheck = mysql_fetch_array(select_query("tblaccounts", "id", array("transid" => $recArr['txid'], "invoice_id" => $result['id'], "gateway" => $gatewaymodule), "id", "DESC", 1)); if ($txCheck['transid']) { //change later to check if txn id already exists in db continue; } # SOMETHING IS WRONG WHAT IS THIS I DONT EVEN if (!is_numeric($recArr['confirmations'])) {
$dbusr = "******"; // database username $dbpwd = "Your_password"; // database password $dbtbl = "Your_DB_Name"; // database name // connect to the database $db_handle = mysql_connect($dbhst, $dbusr, $dbpwd) or die("cannot connect"); $db_found = mysql_select_db($dbtbl) or die("cannot select DB"); $user_session = $_SESSION['user_session']; // set session and check if logged in if (!$user_session) { $Logged_In = 2; } else { $Logged_In = 7; $RPC_Host = "127.0.0.1"; // host for bitcoin rpc $RPC_Port = "8333"; // port for bitcoin rpc $RPC_User = "******"; // username for bitcoin rpc $RPC_Pass = "******"; // password for bitcoin rpc // dont change below here $nu92u5p9u2np8uj5wr = "http://" . $RPC_User . ":" . $RPC_Pass . "@" . $RPC_Host . ":" . $RPC_Port . "/"; $Bytecoind = new jsonRPCClient($nu92u5p9u2np8uj5wr); $wallet_id = "zelles(" . $user_session . ")"; $Bytecoind_Balance = $Bytecoind->getbalance($wallet_id, 6); $Bytecoind_accountaddresses = $Bytecoind->getaddressesbyaccount($wallet_id); $Bytecoind_List_Transactions = $Bytecoind->listtransactions($wallet_id, 10); }
$transactionin = $client->getrawtransaction($vintxid, 1); } catch (Exception $e) { die("Error with getting transaction details.\nYou should add 'txindex=1' to your .conf file and then run the daemon with the -reindex parameter."); } if ($vinvout == 1) { $vinvout = 0; } else { $vinvout = 1; } $address = $transactionin['vout'][!$vinvout]['scriptPubKey']['addresses'][0]; return $address; } while (true) { // Parsing and adding new transactions to database print "Parsing transactions...\n"; $transactions = $client->listtransactions($config['ponziacc'], 100); $i = 0; foreach ($transactions as $trans) { echo "Parsing " . ++$i . "\n"; if ($trans['category'] != "receive" || $trans["confirmations"] < $config['confirmations']) { continue; } if ($trans['amount'] > $config['max'] || $trans['amount'] < $config['min']) { $query = mysql_query('SELECT * FROM `transactions` WHERE `tx` = "' . $trans['txid'] . '";'); if (!mysql_fetch_assoc($query)) { if ($trans['amount'] < 0) { continue; } if ($config['sendback']) { $client->sendtoaddress(getAddress($trans), $trans['amount'] - $trans['amount'] * $config['fee']); } else {
function funct_Billing_JSONRPC_ListTransactions($strWalletAddress) { //give address and get all transactions for that address $mybtc = new jsonRPCClient(JSONRPC_CONNECTIONSTRING); try { //return print_r($mybtc->listaccounts($intConfirmationsCountMin) ); $objJSON = $mybtc->listtransactions($strWalletAddress); return $objJSON; } catch (Exception $e) { echo nl2br($e->getMessage()) . '<br />' . "\n"; } }
if ($transaction["category"] == "receive" && $transaction["confirmations"] >= 4) { process_cryptotransaction($transaction["txid"], $transaction["address"], $transaction["amount"], $transaction["time"], "SLC"); } } else { if ($transaction["category"] == "receive" && $transaction["confirmations"] >= 2) { process_cryptotransaction($transaction["txid"], $transaction["address"], $transaction["amount"], $transaction["time"], "SLC"); } } } ?> Bitcoin: <?php $bitcoin = new jsonRPCClient("http://*****:*****@127.0.0.1:8332/"); $transactions = $bitcoin->listtransactions("", 50); foreach ($transactions as $transaction) { if ($transaction["category"] == "receive" && $transaction["confirmations"] >= 3) { process_cryptotransaction($transaction["txid"], $transaction["address"], $transaction["amount"], $transaction["time"], "BTC"); } } ?> Namecoin: <?php $namecoin = new jsonRPCClient("http://*****:*****@127.0.0.1:8336/"); $transactions = $namecoin->listtransactions("", 30); foreach ($transactions as $transaction) { if ($transaction["category"] == "receive" && $transaction["confirmations"] >= 4) { process_cryptotransaction($transaction["txid"], $transaction["address"], $transaction["amount"], $transaction["time"], "NMC"); } }
$bitcoind = new jsonRPCClient("http://" . $rpc_options[$blockchain]['username'] . ":" . $rpc_options[$blockchain]['password'] . "@" . $rpc_options[$blockchain]['host'] . ":" . $rpc_options[$blockchain]['port'] . "/"); $raw = false; if ($debug && $bitcoind && $loaded) { $raw = $bitcoind->getinfo(); } } if ($call == 'address') { $obj = ["address" => false, "blockchain" => $blockchain, "hash" => "N/A", "tx_count" => 0, "received" => 0, "balance" => 0, "raw" => []]; if (isset($_GET['id']) && $_GET['id']) { $address = $_GET['id']; $obj['address'] = $address; $account_name = 'XXX_' . $address; $balance = $bitcoind->getbalance($account_name, 1, true); $received = $bitcoind->getreceivedbyaccount($account_name, 1); $address = $bitcoind->validateaddress($obj['address']); $txs = $bitcoind->listtransactions($account_name, 100, 0, true); foreach ($txs as $tx_key => $tx) { $raw_tx = $bitcoind->getrawtransaction($tx['txid'], 1); foreach ($raw_tx['vout'] as $output) { if ($output['scriptPubKey']['addresses'][0] == $_GET['id']) { $asm = explode(' ', $output['scriptPubKey']['asm']); foreach ($asm as $op) { if (substr($op, 0, 2) != 'OP') { $obj['hash'] = $op; } } } } } if ($balance) { $obj['balance'] = intval($balance * 100000000);
/* value="アドレス取得" のボタンの処理 */ try { /* アドレス取得 */ $receiveaddress = $coind->getaccountaddress($addrlabel); echo "入金先アドレス:{$receiveaddress}<br /><img src=https://chart.googleapis.com/chart?chs=300&cht=qr&chl=monacoin:MWswpBA9p5V8WHPGYJ7wr1Srzkfr5g51Mn><br />getaccountaddress()で取得するアドレスは、1回入金が行われるたびに変わります。<br />変わった後も、以前に取得したアドレスへの入金は有効です。"; } catch (Exception $e) { echo 'エラー<br />'; } } else { if ($_GET['param'] == "入金チェック") { /* value="入金チェック" のボタンの処理 */ try { /* 指定のラベル(このサンプルではユーザー名=ラベル)のトランザクションを 最新のものから$historyNum分だけ取得。 第三引数の最新のトランザクションからのオフセットです。(省略可)*/ $transactions = $coind->listtransactions($addrlabel, $historyNum, 0); echo $_GET['username'] . "さんの入金履歴<br />"; foreach ($transactions as $transaction) { /* 取得したトランザクションから入金のものだけ抽出 */ if ($transaction['category'] == "receive") { echo date('Y/m/d H:i:s', $transaction['time']) . ': ' . $transaction['amount'] . ' MONA '; /* 2014/02/03 追加 一定期間経過したものだけを入金扱いとする このサンプルではトランザクション発生から 6 block経過したものを承認済みとする */ echo $transaction['confirmations'] < 6 ? '[承認待ち]' : '[承認済み]'; echo "<br>"; } } } catch (Exception $e) { echo 'エラー<br />'; }