function bitcoin_link($params) { # Gateway Specific Variables $u = $params['username']; $p = $params['password']; $h = $params['host'] . ':' . $params['port']; $rpc = 'http://' . $u . ':' . $p . '@' . $h; # Invoice Variables $invoiceid = $params['invoiceid']; $amount = $params['amount']; # Format: ##.## $currency = $params['currency']; # Currency Code # Client Variables $firstname = $params['clientdetails']['firstname']; $lastname = $params['clientdetails']['lastname']; $email = $params['clientdetails']['email']; $address1 = $params['clientdetails']['address1']; $address2 = $params['clientdetails']['address2']; $city = $params['clientdetails']['city']; $state = $params['clientdetails']['state']; $postcode = $params['clientdetails']['postcode']; $country = $params['clientdetails']['country']; $phone = $params['clientdetails']['phonenumber']; # Build Bitcoin Information Here require_once 'bitcoin/jsonRPCClient.php'; $bitcoin = new jsonRPCClient($rpc); if (!$bitcoin->getinfo()) { die('could not connect to bitcoind'); } $address = $bitcoin->getaccountaddress($params['clientdetails']['userid'] . '-' . $invoiceid); # Enter your code submit to the gateway... $code = 'Send Payments to: ' . $address . ''; return $code; }
protected function index() { $this->language->load('payment/' . $this->payment_module_name); $this->data['button_hazecoin_confirm'] = $this->language->get('button_hazecoin_confirm'); $this->data['error_msg'] = $this->language->get('error_msg'); $this->checkUpdate(); $this->load->model('checkout/order'); $order_id = $this->session->data['order_id']; $order = $this->model_checkout_order->getOrder($order_id); $current_default_currency = "USD"; $this->data['hazecoin_total'] = round($this->currency->convert($order['total'], $current_default_currency, "haze"), 4); require_once 'jsonRPCClient.php'; $hazecoin = new jsonRPCClient('http://' . $this->config->get('hazecoin_rpc_username') . ':' . $this->config->get('hazecoin_rpc_password') . '@' . $this->config->get('hazecoin_rpc_address') . ':' . $this->config->get('hazecoin_rpc_port') . '/'); $this->data['error'] = false; try { $hazecoin_info = $hazecoin->getinfo(); } catch (Exception $e) { $this->data['error'] = true; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/hazecoin.tpl')) { $this->template = $this->config->get('config_template') . '/template/payment/hazecoin.tpl'; } else { $this->template = 'default/template/payment/hazecoin.tpl'; } $this->render(); return; } $this->data['error'] = false; $this->data['hazecoin_send_address'] = $hazecoin->getaccountaddress($this->config->get('hazecoin_prefix') . '_' . $order_id); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/hazecoin.tpl')) { $this->template = $this->config->get('config_template') . '/template/payment/hazecoin.tpl'; } else { $this->template = 'default/template/payment/hazecoin.tpl'; } $this->render(); }
function funct_Billing_JSONRPC_GetAccountByLabel($strLabel) { //works //give a label string, get back the first matching address $mybtc = new jsonRPCClient(JSONRPC_CONNECTIONSTRING); $strWalletAddress = $mybtc->getaccountaddress($strLabel); return $strWalletAddress; }
protected function index() { $this->language->load('payment/' . $this->payment_module_name); $this->data['button_bitcoin_pay'] = $this->language->get('button_bitcoin_pay'); $this->data['text_please_send'] = $this->language->get('text_please_send'); $this->data['text_btc_to'] = $this->language->get('text_btc_to'); $this->data['text_to_complete'] = $this->language->get('text_to_complete'); $this->data['text_click_pay'] = $this->language->get('text_click_pay'); $this->data['text_uri_compatible'] = $this->language->get('text_uri_compatible'); $this->data['text_click_here'] = $this->language->get('text_click_here'); $this->data['text_pre_timer'] = $this->language->get('text_pre_timer'); $this->data['text_post_timer'] = $this->language->get('text_post_timer'); $this->data['text_countdown_expired'] = $this->language->get('text_countdown_expired'); $this->data['text_if_not_redirect'] = $this->language->get('text_if_not_redirect'); $this->data['error_msg'] = $this->language->get('error_msg'); $this->data['error_confirm'] = $this->language->get('error_confirm'); $this->data['error_incomplete_pay'] = $this->language->get('error_incomplete_pay'); $this->data['bitcoin_countdown_timer'] = $this->config->get('bitcoin_countdown_timer'); $bitcoin_btc_decimal = $this->config->get('bitcoin_btc_decimal'); $this->checkUpdate(); $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'); $this->data['bitcoin_total'] = sprintf("%." . $bitcoin_btc_decimal . "f", round($this->currency->convert($order['total'], $current_default_currency, "BTC"), $bitcoin_btc_decimal)); $this->db->query("UPDATE `" . DB_PREFIX . "order` SET bitcoin_total = '" . $this->data['bitcoin_total'] . "', date_modified = NOW() WHERE order_id = '" . (int) $order_id . "'"); 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') . '/'); $this->data['error'] = false; try { $bitcoin_info = $bitcoin->getinfo(); } catch (Exception $e) { $this->data['error'] = true; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/bitcoin.tpl')) { $this->template = $this->config->get('config_template') . '/template/payment/bitcoin.tpl'; } else { $this->template = 'default/template/payment/bitcoin.tpl'; } $this->render(); return; } $this->data['error'] = false; $this->data['bitcoin_send_address'] = $bitcoin->getaccountaddress($this->config->get('bitcoin_prefix') . '_' . $order_id); $this->db->query("UPDATE `" . DB_PREFIX . "order` SET bitcoin_address = '" . $this->data['bitcoin_send_address'] . "', date_modified = NOW() WHERE order_id = '" . (int) $order_id . "'"); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/bitcoin.tpl')) { $this->template = $this->config->get('config_template') . '/template/payment/bitcoin.tpl'; } else { $this->template = 'default/template/payment/bitcoin.tpl'; } $this->render(); }
function litecoin_link($params) { full_query("CREATE TABLE IF NOT EXISTS `mod_gw_litecoin_payments` (`invoice_id` int(11) NOT NULL, `amount` float(11,8) NOT NULL, `address` varchar(64) NOT NULL, `confirmations` int(11) NOT NULL, PRIMARY KEY (`invoice_id`))"); full_query("CREATE TABLE IF NOT EXISTS `mod_gw_litecoin_info` (`invoice_id` int(11) NOT NULL, `secret` varchar(64) NOT NULL, `address` varchar(64) NOT NULL, PRIMARY KEY (`invoice_id`))"); $q = mysql_fetch_array(mysql_query("SELECT * FROM `mod_gw_litecoin_info` WHERE invoice_id = '{$params['invoiceid']}'")); if ($q['address']) { $amount = $q['amount']; $address = $q['address']; } $secret = ''; $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; for ($i = 0; $i < 64; $i++) { $secret .= substr($characters, rand(0, strlen($characters) - 1), 1); } # Grab the amount and everything from BTC-e's ticker $ltc_ticker = json_decode(file_get_contents("https://btc-e.com/api/2/ltc_usd/ticker"), true); if (!$ltc_ticker) { return "We're sorry, but you cannot use Litecoin to pay for this transaction at this time."; } $amount = round($params['amount'] / $ltc_ticker['ticker']['sell'], 8); # Build Litecoin Information Here require_once 'whmcscoin/jsonRPCClient.php'; $litecoin = new jsonRPCClient("http://{$params['username']}:{$params['password']}@{$params['host']}:{$params['port']}"); if (!$litecoin->getinfo()) { //This won't work. Gotta make this work. return "We're sorry, but you cannot use Litecoin to pay for this transaction at this time."; } $address = $litecoin->getaccountaddress($secret); if (!$address) { //This probably won't work either.{ return "We're sorry, but you cannot use Litecoin to pay for this transaction at this time."; } $code = 'Please send <strong>' . $params['amount'] . '</strong>worth of LTC to address:<br /><strong><a href="#">' . $address . '</a></strong><br /><span id="ltcprice">Currently, ' . $params['amount'] . ' is <strong>' . $amount . '</strong> LTC</span>'; mysql_query("INSERT INTO `mod_gw_litecoin_info` SET invoice_id = '{$params['invoiceid']}', address = '" . mysql_real_escape_string($address) . "', secret = '{$secret}'"); return "<iframe src='{$params['systemurl']}/modules/gateways/litecoin.php?invoice={$params['invoiceid']}' style='border:none; height:120px'>Your browser does not support frames.</iframe>"; return $code; }
} # Checks gateway module is active before accepting callback # Gateway Specific Variables $u = $GATEWAY['username']; $p = $GATEWAY['password']; $h = $GATEWAY['host'] . ':' . $GATEWAY['port']; $rpc = 'http://' . $u . ':' . $p . '@' . $h; # Build Litecoin Information Here require_once '../litcoin/jsonRPCClient.php'; $litecoin = new jsonRPCClient($rpc); if (!$litecoin->getinfo()) { die('could not connect to litcoind'); } $sql = 'SELECT * FROM tblinvoices WHERE paymentmethod="' . $gatewaymodule . '" AND status = "Unpaid"'; $results = mysql_query($sql); while ($result = mysql_fetch_array($results)) { $amount = $result['total']; $btcaccount = $result['userid'] . '-' . $result['id']; $received = $litecoin->getbalance($btcaccount); //print($received); if ($amount <= $received) { //echo 'PAID'; $fee = 0; $transid = $litecoin->getaccountaddress($btcaccount . '-' . $result['id']); //checkCbTransID($transid); addInvoicePayment($result['id'], $transid, $received, $fee, $gatewaymodule); logTransaction($GATEWAY["name"], array('address' => $transid, 'amount' => $received), "Successful"); } else { //echo 'Still Owes: '.$amount; } }
function before_process() { global $insert_id, $order; $address = $order->customer['email_address'] . '-' . tep_create_random_value(32); require_once 'bitcoin/jsonRPCClient.php'; $bitcoin = new jsonRPCClient('http://' . MODULE_PAYMENT_BITCOIN_LOGIN . ':' . MODULE_PAYMENT_BITCOIN_PASSWORD . '@' . MODULE_PAYMENT_BITCOIN_HOST . '/'); try { $bitcoin->getinfo(); } catch (Exception $e) { $confirmation = array('title' => 'Error: Bitcoin server is down. Please email system administrator regarding your order after confirmation.'); return $confirmation; } $address = $bitcoin->getaccountaddress($address); $order->info['comments'] .= ' | Payment Address: ' . $address . ' | '; return false; }
// coin client 3 password $nv93y54tjwy4t9wn = "http://" . $BTC_RPC_User . ":" . $BTC_RPC_Pass . "@" . $RPC_Host . ":" . $RPC_Port_BTC . "/"; $nu2u5p9u2np8uj5wr = "http://" . $BTE_RPC_User . ":" . $BTE_RPC_Pass . "@" . $RPC_Host . ":" . $RPC_Port_BTE . "/"; $n9nyv35yp9w8un95uw = "http://" . $LTC_RPC_User . ":" . $LTC_RPC_Pass . "@" . $RPC_Host . ":" . $RPC_Port_LTC . "/"; $Bitcoind = new jsonRPCClient($nv93y54tjwy4t9wn); $Bytecoind = new jsonRPCClient($nu2u5p9u2np8uj5wr); $Chncoind = new jsonRPCClient($n9nyv35yp9w8un95uw); $user_session = $_SESSION['user_session']; if (!$user_session) { $Logged_In = 2; } else { $Logged_In = 7; $wallet_id = "zellesExchange(" . $user_session . ")"; $Bitcoind_Account_Address = $Bitcoind->getaccountaddress($wallet_id); $Bytecoind_Account_Address = $Bytecoind->getaccountaddress($wallet_id); $Chncoind_Account_Address = $Chncoind->getaccountaddress($wallet_id); $SQL = "SELECT * FROM balances WHERE username='******'"; $result = mysql_query($SQL); $num_rows = mysql_num_rows($result); if ($num_rows != 1) { if (!mysql_query("INSERT INTO balances (id,username,coin1,coin2,coin3,coin4,coin5,coin6,coin7,coin8,coin9,coin10) VALUES ('','{$user_session}','0','0','0','0','0','0','0','0','0','0')")) { die("Server error"); } else { $r_system_action = "success"; } } $SQL = "SELECT * FROM addresses WHERE username='******'"; $result = mysql_query($SQL); $num_rows = mysql_num_rows($result); if ($num_rows != 1) { if (!mysql_query("INSERT INTO addresses (id,username,coin1,coin2,coin3,coin4,coin5,coin6,coin7,coin8,coin9,coin10) VALUES ('','{$user_session}','{$Bitcoind_Account_Address}','{$Bytecoind_Account_Address}','{$Chncoind_Account_Address}','0','0','0','0','0','0','0')")) {
} $ps .= $nextchar; } $s->query("insert into users (username,password,email,address,webkey,verified) values ('" . $s->real_escape_string($username) . "','" . $s->real_escape_string($p->HashPassword($ps)) . "','" . $s->real_escape_string($_POST['e']) . "','','" . $s->real_escape_string($id) . "',0)"); // now generate the tipbot address. include "jsonRPCClient.php"; $dogetip = new jsonRPCClient("https://*****:*****@127.0.0.1:22557/"); $id = $s->insert_id; if (!$id) { $id = $s->query("select id from users where username='******'")->fetch_object()->id; } if (!$id) { die("Something failed. Go back and try again."); } try { $tipaddress = $dogetip->getaccountaddress("dogec0in_" . $id); } catch (Exception $e) { $tipaddress = ''; } $s->query("update users set address='" . $s->real_escape_string($tipaddress) . "' where id=" . $id); session_start(); $rid = $_SESSION['ref']; if ($rid == "") { $rid = 0; } $s->query("insert into referrals (uid,rid) values (" . $id . "," . $rid . ")"); $vu = "http://" . $_SERVER['HTTP_HOST'] . "/?a=v&v=" . urlencode($id . "|" . sha1('dogec0inisthebestwaterbowlever!' . $username . $_POST['e'] . $tipaddress)); doMail($_POST['u'] . " <" . $_POST['e'] . ">", "[dogec0in] Account Verification", $username . ",\n\nYou have (or someone using your email address has) just registered at dogec0in.\nTo verify your registration and start earning free Dogecoins by chatting, visit this link: " . $vu . "\n\nYour username is: " . $username . "\nYour password is: " . $ps . "\n\nIf you did not intend to receive this email, just ignore it and nothing will happen.\nEnjoy dogec0in!"); ?> <!DOCTYPE html> <html lang="en">
<tr><td>serverid</td><td><?php echo $row[8]; ?> </td></tr> <? foreach($binfo as $bkey=>$bvalue){ if(strlen($bvalue)>0){ echo "<tr><td>".$bkey."</td><td>"; if($bkey=="blocks"){ echo "<b>"; } echo $bvalue; if($bkey=="blocks"){ echo "</b>"; } echo "</td></tr>"; } } ?> <? if(isset($_GET['auth'])){ echo "<tr><td>rpcuser</td><td>".$row[9]."</td></tr>"; } ?> <? if(isset($_GET['auth'])){ echo "<tr><td>rpcpassword</td><td>".$row[10]."</td></tr>"; } ?> <tr><td>walletaddress_main</td><td><?php echo $bitcoin->getaccountaddress(""); ?> </td></tr> <tr><td>walletaddress_misc</td><td><?php echo $bitcoin->getaccountaddress("misc"); ?> </td></tr> </table> <?php mysqli_close($con);
/* monacoin.conf で指定した rpcパスワード */ $rpcport = '4000'; /* monacoin.conf で指定した rpcポート */ $historyNum = 50; /* 取得するトランザクション数 */ if (isset($_GET['param']) && isset($_GET['username'])) { /* monacoind への接続アドレス */ $coindaddr = "http://{$rpcuser}:{$rpcpassword}@{$host}:{$rpcport}/"; $coind = new jsonRPCClient($coindaddr); /* 入金アドレスのlabel。このサンプルではユーザー名をそのままラベルに使用しています */ $addrlabel = $_GET['username']; if ($_GET['param'] == "アドレス取得") { /* 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) { /* 取得したトランザクションから入金のものだけ抽出 */