Example #1
1
 /**
  * Simple procedure to test most RPC functions
  *
  */
 public function test()
 {
     $sFileToImport = dirname(Yii::app()->basePath) . DIRECTORY_SEPARATOR . 'docs' . DIRECTORY_SEPARATOR . 'demosurveys' . DIRECTORY_SEPARATOR . 'limesurvey2_sample_survey_english.lss';
     //        $sFileToImport=dirname(Yii::app()->basePath).DIRECTORY_SEPARATOR.'docs'.DIRECTORY_SEPARATOR.'demosurveys'.DIRECTORY_SEPARATOR.'survey_archive_example_feedback_survey.zip';
     Yii::app()->loadLibrary('jsonRPCClient');
     $myJSONRPCClient = new jsonRPCClient(Yii::app()->getBaseUrl(true) . '/' . dirname(Yii::app()->request->getPathInfo()));
     $sSessionKey = $myJSONRPCClient->get_session_key('admin', 'password');
     if (is_array($sSessionKey)) {
         echo $sSessionKey['status'];
         die;
     } else {
         echo 'Retrieved session key' . '<br>';
     }
     $sLSSData = base64_encode(file_get_contents($sFileToImport));
     $iSurveyID = $myJSONRPCClient->import_survey($sSessionKey, $sLSSData, 'zip', 'Test import by JSON_RPC', 1000);
     echo 'Created new survey SID:' . $iSurveyID . '<br>';
     /*
             Very simple example to export responses as Excel file
             $aResult=$myJSONRPCClient->export_reponses($sSessionKey,$iSurveyID,'xls');
             file_put_contents('d:\test.xls',base64_decode(chunk_split($aResult)));
     */
     $aResult = $myJSONRPCClient->activate_survey($sSessionKey, $iSurveyID);
     if ($aResult['status'] == 'OK') {
         echo 'Survey ' . $iSurveyID . ' successfully activated.<br>';
     }
     $aResult = $myJSONRPCClient->activate_participant_tokens($sSessionKey, $iSurveyID, array(1, 2));
     if ($aResult['status'] == 'OK') {
         echo 'Tokens for Survey ID ' . $iSurveyID . ' successfully activated.<br>';
     }
     $aResult = $myJSONRPCClient->set_survey_properties($sSessionKey, $iSurveyID, array('faxto' => '0800-LIMESURVEY'));
     if ($aResult['status'] == 'OK') {
         echo 'Modified survey settings for survey ' . $iSurveyID . '<br>';
     }
     $aResult = $myJSONRPCClient->add_survey_language($sSessionKey, $iSurveyID, 'ar');
     if ($aResult['status'] == 'OK') {
         echo 'Added Arabian as additional language' . '<br>';
     }
     $aResult = $myJSONRPCClient->set_survey_language_properties($sSessionKey, $iSurveyID, array('surveyls_welcometext' => 'An Arabian welcome text!'), 'ar');
     if ($aResult['status'] == 'OK') {
         echo 'Modified survey locale setting welcometext for Arabian in survey ID ' . $iSurveyID . '<br>';
     }
     $aResult = $myJSONRPCClient->delete_survey_language($sSessionKey, $iSurveyID, 'ar');
     if ($aResult['status'] == 'OK') {
         echo 'Removed Arabian as additional language' . '<br>';
     }
     die;
     $aResult = $myJSONRPCClient->delete_survey($sSessionKey, $iSurveyID);
     echo 'Deleted survey SID:' . $iSurveyID . '-' . $aResult['status'] . '<br>';
     // Release the session key - close the session
     $Result = $myJSONRPCClient->release_session_key($sSessionKey);
     echo 'Closed the session' . '<br>';
 }
Example #2
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');
     $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";
     }
 }
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;
}
 function AutoResponderGetResponseAPI($that, $ar, $wpm_id, $email, $unsub = false)
 {
     global $wpdb;
     require_once $that->pluginDir . '/extlib/jsonRPCClient.php';
     if ($ar['campaign'][$wpm_id]) {
         $campaign = trim($ar['campaign'][$wpm_id]);
         $name = trim($that->ARSender['name']);
         $email = trim($that->ARSender['email']);
         $api_key = trim($ar['apikey']);
         $api_url = empty($ar['api_url']) ? "http://api2.getresponse.com" : trim($ar['api_url']);
         $grUnsub = $ar['grUnsub'][$wpm_id] == 1 ? true : false;
         $uid = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE `user_email`='" . esc_sql($that->ARSender['email']) . "'");
         $ip = trim($that->Get_UserMeta($uid, 'wpm_login_ip'));
         $ip = $ip ? $ip : trim($that->Get_UserMeta($uid, 'wpm_registration_ip'));
         $ip = $ip ? $ip : trim($_SERVER['REMOTE_ADDR']);
         try {
             if (!extension_loaded('curl') || !extension_loaded('json')) {
                 # these extensions are a must
                 throw new Exception("CURL and JSON are modules required to use" . " the GetResponse Integration");
             }
             $api = new jsonRPCClient($api_url);
             #get the campaign id
             $resp = $api->get_campaigns($api_key);
             $cid = null;
             if (!empty($resp)) {
                 foreach ($resp as $i => $item) {
                     if (strtolower($item['name']) == strtolower($campaign)) {
                         $cid = $i;
                     }
                 }
             }
             if (empty($cid)) {
                 throw new Exception("Could not find campaign {$campaign}");
             }
             if ($unsub) {
                 if ($grUnsub) {
                     //list contacts
                     $contacts = $api->get_contacts($api_key, array('campaigns' => array($cid), 'email' => array('EQUALS' => "{$email}")));
                     if (empty($contacts)) {
                         #could not find the contact, nothing to remove
                         return;
                     }
                     $pid = key($contacts);
                     $res = $api->delete_contact($api_key, array('contact' => $pid));
                     if (empty($res)) {
                         throw new Exception("Empty server response while deleting contact");
                     }
                 }
             } else {
                 $resp = $api->add_contact($api_key, array('campaign' => $cid, 'name' => $name, 'email' => $email, 'ip' => $ip, 'cycle_day' => 0));
                 if (empty($resp)) {
                     throw new Exception("Empty server response while sending");
                 }
             }
         } catch (Exception $e) {
             return;
         }
     }
 }
 public function jsonRPCAct()
 {
     vendor('jsonRPC.jsonRPCClient');
     $client = new \jsonRPCClient('http://localhost:8500/Api/JsonRPCTest');
     $result = $client->test();
     var_dump($result);
     // 结果:
 }
Example #6
0
 /**
  * Simple procedure to test most RPC functions
  *
  */
 public function test()
 {
     $RPCType = Yii::app()->getConfig("RPCInterface");
     $serverUrl = Yii::app()->getBaseUrl(true) . '/' . dirname(Yii::app()->request->getPathInfo());
     $sFileToImport = dirname(Yii::app()->basePath) . DIRECTORY_SEPARATOR . 'docs' . DIRECTORY_SEPARATOR . 'demosurveys' . DIRECTORY_SEPARATOR . 'limesurvey2_sample_survey_english.lss';
     if ($RPCType == 'xml') {
         require_once 'Zend/XmlRpc/Client.php';
         $client = new Zend_XmlRpc_Client($serverUrl);
     } elseif ($RPCType == 'json') {
         Yii::app()->loadLibrary('jsonRPCClient');
         $client = new jsonRPCClient($serverUrl);
     }
     $sSessionKey = $client->call('get_session_key', array('admin', 'password'));
     if (is_array($sSessionKey)) {
         echo $sSessionKey['status'];
         die;
     } else {
         echo 'Retrieved session key' . '<br>';
     }
     $sLSSData = base64_encode(file_get_contents($sFileToImport));
     $iSurveyID = $client->call('import_survey', array($sSessionKey, $sLSSData, 'lss', 'Test import by JSON_RPC', 1000));
     echo 'Created new survey SID:' . $iSurveyID . '<br>';
     $aResult = $client->call('activate_survey', array($sSessionKey, $iSurveyID));
     if ($aResult['status'] == 'OK') {
         echo 'Survey ' . $iSurveyID . ' successfully activated.<br>';
     }
     $aResult = $client->call('activate_tokens', array($sSessionKey, $iSurveyID, array(1, 2)));
     if ($aResult['status'] == 'OK') {
         echo 'Tokens for Survey ID ' . $iSurveyID . ' successfully activated.<br>';
     }
     $aResult = $client->call('set_survey_properties', array($sSessionKey, $iSurveyID, array('faxto' => '0800-LIMESURVEY')));
     if (!array_key_exists('status', $aResult)) {
         echo 'Modified survey settings for survey ' . $iSurveyID . '<br>';
     }
     $aResult = $client->call('add_language', array($sSessionKey, $iSurveyID, 'ar'));
     if ($aResult['status'] == 'OK') {
         echo 'Added Arabian as additional language' . '<br>';
     }
     $aResult = $client->call('set_language_properties', array($sSessionKey, $iSurveyID, array('surveyls_welcometext' => 'An Arabian welcome text!'), 'ar'));
     if ($aResult['status'] == 'OK') {
         echo 'Modified survey locale setting welcometext for Arabian in survey ID ' . $iSurveyID . '<br>';
     }
     $aResult = $client->call('delete_language', array($sSessionKey, $iSurveyID, 'ar'));
     if ($aResult['status'] == 'OK') {
         echo 'Removed Arabian as additional language' . '<br>';
     }
     //Very simple example to export responses as Excel file
     //$aResult=$client->call('export_responses', array($sSessionKey,$iSurveyID,'xls'));
     //$aResult=$client->call('export_responses', array($sSessionKey,$iSurveyID,'pdf'));
     //$aResult=$client->call('export_responses', array($sSessionKey,$iSurveyID,'doc'));
     $aResult = $client->call('export_responses', array($sSessionKey, $iSurveyID, 'csv'));
     //file_put_contents('test.xls',base64_decode(chunk_split($aResult)));
     $aResult = $client->call('delete_survey', array($sSessionKey, $iSurveyID));
     echo 'Deleted survey SID:' . $iSurveyID . '-' . $aResult['status'] . '<br>';
     // Release the session key - close the session
     $Result = $client->call('release_session_key', array($sSessionKey));
     echo 'Closed the session' . '<br>';
 }
 public static function transactionLookup($tx)
 {
     $wallet = new jsonRPCClient(HOTWALLET, true);
     $getRawTransaction = $wallet->getrawtransaction($tx);
     $decodeRawTransaction = $wallet->decoderawtransaction($getRawTransaction);
     $return['rawtransaction'] = $getRawTransaction;
     $return['transaction'] = $decodeRawTransaction;
     return $return;
 }
Example #8
0
function get_block_info($block){
	require_once('/var/www/midas/root/private/class/jsonRPCClient.php');
	$darkcoin = new jsonRPCClient('http://*****:*****@127.0.0.1:9998/');
	$hash_block = $darkcoin->getblockhash(intval($block));
	
	$info_block = $darkcoin->getblock($hash_block);
	$tx = $info_block["tx"][0];
	$diff = round($info_block["difficulty"]);
	$last_block = $block_id = $info_block["height"];
	$block_time = $info_block["time"];
	return $info_block;
}
function sendToAddress($address, $amount)
{
    try {
        $amount = round($amount, 8);
        $bitcoin = new jsonRPCClient(kBitcoinURL);
        $txid = $bitcoin->sendtoaddress($address, floatval($amount));
        $log = new MessageLog('log', 255);
        $log->write("mywallet-bitcoin:{$address} BTC:{$amount} txid:{$txid}");
        return $txid;
    } catch (Exception $e) {
        return "Error: " . $e->getMessage();
    }
}
Example #10
0
/**
 * Return an array of objects representing search results.
 *
 * See: http://www.bugzilla.org/docs/4.2/en/html/api/Bugzilla/WebService/Bug.html#search
 *
 * @param array $params search fields => values
 * @return array of stdClass bug objects for given search
 * @return boolean false if search failed altogether (I think)
 */
function search(array $params)
{
    $client = new jsonRPCClient("https://bugzilla.wikimedia.org/jsonrpc.cgi");
    try {
        $result = $client->call('Bug.search', array($params));
    } catch (\Exception $e) {
        Fail::log($e);
        return false;
    }
    $bugs = array();
    for ($i = 0, $c = count($result[1]['bugs']); $i < $c; ++$i) {
        $bugs[] = (object) $result[1]['bugs'][$i];
    }
    return $bugs;
}
 public function indeed_getResponse($api_key, $token, $e_mail, $full_name = '')
 {
     require_once $this->dir_path . '/email_services/getresponse/jsonRPCClient.php';
     $api = new jsonRPCClient('http://api2.getresponse.com');
     $args = array('campaign' => $token, 'email' => $e_mail);
     if (!empty($full_name)) {
         $args['name'] = $full_name;
     }
     $res = $api->add_contact($api_key, $args);
     if ($res) {
         return 1;
     } else {
         return 0;
     }
 }
Example #12
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";
     }
 }
Example #13
0
function sendBtc($id, $amount)
{
    #Send btc from id to address
    $bitcoin = new jsonRPCClient("http://{$bitcoin_user}:{$bitcoin_pass}@127.0.0.1:8332/");
    if ($bitcoin->getbalance() < $amount) {
        return -1;
    }
    if (!debit($id, $amount)) {
        return -2;
    }
    $address = getAddress($id);
    if ($address == -1) {
        return -3;
    }
    $comment = getUsernameById($id);
    $bitcoin->sendtoaddress($address, $amount, $comment);
    return 0;
}
Example #14
0
 function process()
 {
     global $order;
     if (!$this->enabled) {
         return;
     }
     $client = new jsonRPCClient('http://api2.getresponse.com');
     $result = NULL;
     try {
         $result = $client->get_campaigns(MODULE_ORDER_TOTAL_GETRESPONSE_API_KEY, array('name' => array('EQUALS' => MODULE_ORDER_TOTAL_GETRESPONSE_CAMPAIGN)));
         if (empty($result)) {
             throw new Exception('Missing GetResponse campaign: ' . MODULE_ORDER_TOTAL_GETRESPONSE_CAMPAIGN);
         }
         $client->add_contact(MODULE_ORDER_TOTAL_GETRESPONSE_API_KEY, array('campaign' => array_pop(array_keys($result)), 'name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'email' => $order->customer['email_address'], 'cycle_day' => '0', 'customs' => array(array('name' => 'ref', 'content' => STORE_NAME), array('name' => 'telephone', 'content' => $order->customer['telephone']), array('name' => 'country', 'content' => $order->customer['country']['title']), array('name' => 'city', 'content' => $order->customer['city']))));
     } catch (Exception $e) {
         error_log($e->getMessage());
         return;
     }
 }
 /**
  * Subscribes to GetResponse list. Returns either "success" string or error message.
  * @return string
  */
 function subscribe_get_response($list, $email, $api_key, $name = '-')
 {
     if (!function_exists('curl_init')) {
         return;
     }
     require_once RAD_RAPIDOLOGY_PLUGIN_DIR . 'subscription/getresponse/jsonrpcclient.php';
     $api_url = 'http://api2.getresponse.com';
     $name = '' == $name ? '-' : $name;
     $client = new jsonRPCClient($api_url);
     $result = $client->add_contact($api_key, array('campaign' => $list, 'name' => $name, 'email' => $email));
     if (isset($result['result']['queued']) && 1 == $result['result']['queued']) {
         $result = 'success';
     } else {
         if (isset($result['error']['message'])) {
             $result = $result['error']['message'];
         } else {
             $result = 'unknown error';
         }
     }
     return $result;
 }
 public function validateaddress($coin_address)
 {
     try {
         $aStatus = parent::validateaddress($coin_address);
         if (!$aStatus['isvalid']) {
             return false;
         }
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
Example #17
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 = "USD";
     $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') . '/');
     try {
         $hazecoin_info = $hazecoin->getinfo();
     } catch (Exception $e) {
         $this->data['error'] = true;
     }
     $received_amount = $hazecoin->getreceivedbyaccount($this->config->get('hazecoin_prefix') . '_' . $order_id, 0);
     if (round((double) $received_amount, 4) >= round((double) $hazecoin_total, 4)) {
         $order = $this->model_checkout_order->getOrder($order_id);
         $this->model_checkout_order->confirm($order_id, $this->config->get('hazecoin_order_status_id'));
         echo true;
     } else {
         echo false;
     }
 }
Example #18
0
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;
}
Example #19
0
ユーザー名:
<input type=text size="40" name="username" value=""><br />
<input type="submit" name="param" value="アドレス取得">
<input type="submit" name="param" value="入金チェック">
</form>
<?php 
require_once __DIR__ . '/jsonRPCClient.php';
$host = 'localhost';
/* monacoind 又は monacoin-qt を実行中のホストのアドレス */
$rpcuser = '******';
/* monacoin.conf で指定した rpcユーザー名 */
$rpcpassword = '******';
/* monacoin.conf で指定した rpcパスワード */
$rpcport = '4000';
/* monacoin.conf で指定した rpcポート */
$historyNum = 50;
/* 取得するトランザクション数 */
/* monacoind への接続アドレス */
$coindaddr = "http://{$rpcuser}:{$rpcpassword}@{$host}:{$rpcport}/";
$coind = new jsonRPCClient($coindaddr);
$info = $coind->getinfo();
echo "Balance: <div id=balance>{$info['balance']}</div>";
$list = $coind->listaccounts();
print_r($list);
?>
<div id="COUNTDOWN">0</div>
<div id="BTCMONA">wait</div>
</body>
</html>

include "../../../includes/invoicefunctions.php";
$gatewaymodule = "litecoin";
# Enter your gateway module name here replacing template
$GATEWAY = getGatewayVariables($gatewaymodule);
if (!$GATEWAY["type"]) {
    die("Module Not Activated");
}
# 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);
Example #21
0
 function getHouseBalance()
 {
     try {
         $bitcoind = new jsonRPCClient('http://' . $this->__get("username") . ':' . $this->__get("password") . '@' . $this->__get("btcserver") . ':' . $this->__get("btcport") . '/');
         $balance = $bitcoind->getbalance("bitsman");
         return $balance;
     } catch (Exception $e) {
         return 0;
     }
 }
Example #22
0
            foreach ($currencies2 as $currency) {
                $currency = strtoupper($currency);
                $slt_trade_order_a = "SELECT *, UNIX_TIMESTAMP(filing_time) AS filing_time_u, UNIX_TIMESTAMP(finishing_time) AS finishing_time_u FROM trade_order WHERE user = '******' AND currency = '{$currency}'";
                $rlt_trade_order_a = mysql_query($slt_trade_order_a);
                while ($row_trade_order_a = mysql_fetch_assoc($rlt_trade_order_a)) {
                    $orders[strtolower($currency)][] = array("id" => $row_trade_order_a["id"], "creation_time" => $row_trade_order_a["filing_time_u"], "finishing_time" => $row_trade_order_a["finishing_time_u"], "currency" => strtolower($row_trade_order_a["currency"]), "type" => $row_trade_order_a["type"], "price" => api_price_format($row_trade_order_a["price"]), "amount" => api_sc_format($row_trade_order_a["amount"]), "completed" => api_sc_format($row_trade_order_a["completed"]), "active" => $row_trade_order_a["active"]);
                }
            }
            json_success($orders);
        }
    }
}
// 4 Transfer
if ($query[0] == "transfer") {
    require_authentification();
    $solidcoin = new jsonRPCClient("http://*****:*****@127.0.0.1:7556/");
    if ($query[1] == "deposit") {
        // 4.1 Deposits
        if ($query[2] == "new") {
            // 4.1.1 Create deposit address
            $group = mysql_real_escape_string($_GET["g"], $db);
            if ($_GET["m"] != "yes") {
                $mail = "no";
            } else {
                $mail = "yes";
            }
            $callback = mysql_real_escape_string($_GET["c"], $db);
            $data = mysql_real_escape_string($_GET["d"], $db);
            if (strlen($data) > 1024) {
                json_error("Data too long.");
            }
Example #23
0
<?php

require_once 'jsonRPCClient.php';
$electrum = new jsonRPCClient('http://localhost:7777');
echo '<b>Wallet balance</b><br />' . "\n";
try {
    $balance = $electrum->getbalance();
    echo 'confirmed: <i>' . $balance['confirmed'] . '</i><br />' . "\n";
    echo 'unconfirmed: <i>' . $balance['unconfirmed'] . '</i><br />' . "\n";
} catch (Exception $e) {
    echo nl2br($e->getMessage()) . '<br />' . "\n";
}
/**
 * Displays the doctor search results in a body box
 */
function display_search_result_body($page = 1, $results = 10)
{
    global $icq_speciality_id_json, $icq_location;
    $icq_speciality_id_json_val = get_option($icq_speciality_id_json);
    $icq_location_val = get_option($icq_location);
    //call the icliniq's json webservuce to get the dictor list
    $objClient = new jsonRPCClient('http://icliniq.com/webservice/index');
    try {
        //call this method from network
        $arrData = $objClient->listDoctors($icq_speciality_id_json_val, $icq_location_val, $page, $results);
        echo '<table style="width:100%;" cellspacing="0" cellpading="0" border="0">';
        foreach ($arrData as $rowData) {
            ?>
		<tr>
		  <td style="padding:5px 0 5px 0; vertical-align:top; border-bottom:1px #ccc solid;width:85px;">
		    <a href="http://www.icliniq.com/doctor/profile/user_id/<?php 
            echo $rowData['id'];
            ?>
"><img width="70" src="<?php 
            echo $rowData['photo'];
            ?>
" border="0" /></a>
		  </td>
		  <td style="padding:5px 0 5px 5px; vertical-align:top; border-bottom:1px #ccc solid;">
		    <div style="padding-bottom:5px;"><a href="http://www.icliniq.com/doctor/profile/user_id/<?php 
            echo $rowData['id'];
            ?>
"><b>Dr.<?php 
            echo $rowData['name'];
            ?>
</b></a></div>
			<div style="padding-bottom:5px;"><small><?php 
            echo $rowData['education'];
            ?>
</small></div>
			<div style="padding-bottom:5px;"><small><b><?php 
            echo $rowData['speciality'];
            ?>
</b></small></div>
			
			<div style="padding-top:15px; padding-bottom:10px;">
			  <a href="http://localhost/xampp/htdocs/icliniq/web/dev.php/appointment/chooseAppointmentDate/doctor/<?php 
            echo $rowData['id'];
            ?>
">Book an Appointment</a> |
			  <a href="https://www.icliniq.com/ask-a-doctor-online" title="Ask a doctor online">Ask a Health Query</a>
			</div>
		  </td>
		</tr>
<?php 
        }
        echo '</table>';
    } catch (Exception $e) {
    }
}
Example #25
0
     require_once LS_RPC_PATH;
 } else {
     die(print_r(LS_RPC_PATH, true));
 }
 // get all evaluations for a given relation
 $relation_id = array_key_exists('relation_id', $_REQUEST) ? (int) $_REQUEST['relation_id'] : null;
 $relation_step = array_key_exists('step', $_REQUEST) ? (int) $_REQUEST['step'] : null;
 $evaluation_id = array_key_exists('evaluation_id', $_REQUEST) ? (int) $_REQUEST['evaluation_id'] : null;
 $evaluations = [];
 if ($relation_id) {
     $evaluations = RelationModel::evaluations($relation_id);
 } elseif ($evaluation_id) {
     $evaluations[] = pods('evaluation', $evaluation_id);
 }
 // instanciate a new client
 $myJSONRPCClient = new jsonRPCClient(LS_BASEURL);
 // receive session key
 $sessionKey = $myJSONRPCClient->get_session_key(LS_USER, LS_PASSWORD);
 // calculate averages for current evaluation
 $response = [];
 foreach ($evaluations as $key => $evaluation) {
     $limesurvey_id = EvaluationModel::surveyID($evaluation->ID, $relation_step);
     $type = $relation_step === '360' ? 'company' : 'agency';
     // questions
     $questions_filename = $type . '_' . $limesurvey_id . '_questions.json';
     $survey_questions = json_decode(file_get_contents(CABSPATH . 'cache/' . $questions_filename), true);
     $group_q = ['OP' => [], 'OM' => [], 'TM' => []];
     foreach ($survey_questions as $rolekey => $rolevalue) {
         foreach ($rolevalue as $sqkey => $sqvalue) {
             if (!array_key_exists($sqvalue['g']['id']['gid'], $group_q[$rolekey])) {
                 $group_q[$rolekey][$sqvalue['g']['id']['gid']] = ['name' => $sqvalue['g']['group_name'], 'gid' => $sqvalue['g']['id']['gid'], 'questions' => [], 'question_benchmarks' => [], 'questions_txt' => []];
Example #26
0
?>
" height="100"></a><br><?php 
echo $faucetSubtitle;
?>
</h3>
      <fieldset>

        <!-- ADS ADS ADS ADS ADS ADS ADS ADS ADS -->
        <a href="https://hashflare.io/r/69295B0A-ads"><img src="https://hashflare.io/banners/468x60-eng-2.jpg" alt="HashFlare"></a>
        <!-- ADS ADS ADS ADS ADS ADS ADS ADS ADS -->

        <br>


          <?php 
$bitcoin = new jsonRPCClient('http://127.0.0.1:8070/json_rpc');
$balance = $bitcoin->getbalance();
$balanceDisponible = $balance['available_balance'];
$lockedBalance = $balance['locked_amount'];
$dividirEntre = 100000000;
$totalBCN = ($balanceDisponible + $lockedBalance) / $dividirEntre;
$recaptcha = new Recaptcha($keys);
//Available Balance
$balanceDisponibleFaucet = number_format(round($balanceDisponible / $dividirEntre, 8), 8, '.', '');
?>

        <form action="request.php" method="POST">

          <?php 
if (isset($_GET['msg'])) {
    $mensaje = $_GET['msg'];
Example #27
0
#ini_set("display_errors", false);
require "config.php";
require "jsonRPCClient.php";
session_start();
if (isset($_POST['currentWallet']) && !empty($_POST['currentWallet'])) {
    $_SESSION['currentWallet'] = $_POST['currentWallet'];
}
if (isset($_SESSION['currentWallet']) && !empty($_SESSION['currentWallet'])) {
    $currentWallet = $_SESSION['currentWallet'];
} else {
    $keys = array_keys($wallets);
    $currentWallet = $keys[0];
    $_SESSION['currentWallet'] = $currentWallet;
}
$nmcu = $wallets[$currentWallet];
$nmc = new jsonRPCClient("{$nmcu['protocol']}://{$nmcu['user']}:{$nmcu['pass']}@{$nmcu['host']}:{$nmcu['port']}", true);
try {
    $nmcinfo = $nmc->getinfo();
} catch (exception $e) {
    die("Failed to retrieve data from the daemon, please check your configuration, and ensure that your coin daemon is running:<br>  {$e}");
}
$wallet_encrypted = true;
try {
    $nmc->walletlock();
} catch (Exception $e) {
    // Wallet is not encrypted
    $wallet_encrypted = false;
}
// Begin bootstrap code
?>
<!DOCTYPE html>
Example #28
0
<?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;
    }
Example #29
0
<?php

/*
 *  © CryptoDice 
 *  
 *  
 *    
*/
header('X-Frame-Options: DENY');
$included = true;
include '../../inc/db-conf.php';
include '../../inc/wallet_driver.php';
$wallet = new jsonRPCClient($driver_login);
include '../../inc/functions.php';
if (empty($_GET['amount']) || empty($_GET['valid_addr']) || empty($_GET['_unique']) || mysql_num_rows(mysql_query("SELECT `id` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1")) == 0) {
    exit;
}
$player = mysql_fetch_array(mysql_query("SELECT `id`,`balance` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1"));
$validate = $wallet->validateaddress($_GET['valid_addr']);
if ($validate['isvalid'] == false) {
    $error = 'yes';
    $con = 0;
} else {
    $player = mysql_fetch_array(mysql_query("SELECT `id`,`balance` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1"));
    if (!is_numeric($_GET['amount']) || (double) $_GET['amount'] > $player['balance'] || (double) $_GET['amount'] < $settings['min_withdrawal']) {
        $error = 'yes';
        $con = 1;
    } else {
        $amount = (double) $_GET['amount'];
        $txid = $wallet->sendtoaddress($_GET['valid_addr'], $amount);
        if ((string) $txid != '') {
Example #30
0
$_PHP_SELF;
?>
" method="POST">
<b>Select the format you want to view the system uptime on</b><br>
  <input type="radio" name="name" value=" ">Normal format<br>
  <input type="radio" name="name" value="-s">MM:HH:SS format<br>
  <input type="radio" name="name" value="-p">Short Format<br>
    <input type="radio" name="name" value="find">Windows Format (Only on Windows Systems)<br>
<br><input type="Submit" /><br>
      </form>                                      
                   
   </body>

<?php 
require_once 'jsonRPCClient.php';
$myExample = new jsonRPCClient('http://127.0.0.1/dvws/vulnerabilities/cmdi/server.php');
// performs some basic operation
try {
    echo 'This application is using <i>' . $myExample->giveMeSomeData('name') . ' to execute commands:</i><br />' . "\n";
    $myExample->changeYourState('I am using this function from the network');
} catch (Exception $e) {
    echo nl2br($e->getMessage()) . '<br />' . "\n";
}
if (isset($_POST["name"])) {
    echo '<br /><b>The current system uptime is</b><br />' . "\n";
    try {
        echo $myExample->getsystemstatus($_POST["name"]);
    } catch (Exception $e) {
        echo nl2br($e->getMessage());
    }
}