2016-04-23 22 views
-3
<form method="GET" action="[insert_php]$url ='https://block.io/api/v2/withdraw_from_labels/?api_key=' . $apiKey .'&from_labels='.$user.'&amounts='.$amount.'&to_addresses='.$address.'&pin='. $pin.'&priority=medium'; 
[/insert_php]"> 
<input type="submit" name="submitted" value="withdraw"></form> 

このコードは、ボタンが押される前に実行されます。HTMLボタンが押されずに送信されています

以下はワードプレスのページの内容ですが、私はワードプレスエディタを使ってコードを書くので、この[コード]のように表示されます。 $ user変数はユーザーを保護するためにここにのみあり、このページでは使用されていません。

Investments 
<hr> 
Work in progress 


<hr> 
User Wallet information 
<hr> 

[insert_php] 
global $apiKey; 
global $pin; 

$url = 'https://block.io/api/v2/get_address_balance/?api_key=' . $apiKey . '&labels='.$user'; 
$response = wp_remote_request($url); 
$body = wp_remote_retrieve_body($response); 
$data = json_decode($body, true); 
//print_r($data); 

foreach ($data as $item) { 
$uses = $item['balances']['0']; 
} 
$urlUSD = 'https://block.io/api/v2/get_current_price/?api_key=' . $apiKey . '&price_base=USD'; 
$responseUSD = wp_remote_request($urlUSD); 
$bodyUSD = wp_remote_retrieve_body($responseUSD); 
$dataUSD = json_decode($bodyUSD, true); 

foreach ($dataUSD as $itemUSD){ 
$btc_e = $itemUSD[prices][0]; 
$coinbase = $itemUSD[prices][1]; 
$bitfinix = $itemUSD[prices][2]; 
$bitstamp = $itemUSD[prices][3]; 

} 

$url2 = 'https://block.io/api/v2/get_network_fee_estimate/?api_key='. $apiKey .'&amounts='. $uses['available_balance'] .'&to_addresses='.$address.'&priority=medium'; 
$response2 = wp_remote_request($url2); 
$body2 = wp_remote_retrieve_body($response2); 
$data2 = json_decode($body2, true); 
//print_r($data2); 

foreach ($data2 as $item2) { 
$network = $item2['estimated_network_fee']; 
} 
//print $network; 
$fee = '0.0008'; 
$amount = $uses['available_balance'] - $network; 
$USD = $uses['available_balance'] * $coinbase['price']; 
//print_r($amount); 

[/insert_php] 
<table border="2"> 
<tr> 
    <td>User</td> 
    <td>Address</td> 
    <td>Available Balance</td> 
    <td>Estimated Network Fee</td> 
</tr> 
<tr> 
    <td>[insert_php]print $uses['label'];[/insert_php]</td> 
    <td>[insert_php]print $uses['address'];[/insert_php]</td> 
    <td>฿[insert_php]print $uses['available_balance'];[/insert_php]|[insert_php]echo Money_format('$ %.2n',$USD);[/insert_php]</td> 
    <td>฿[insert_php]print $network;[/insert_php]</td> 
</tr> 

<form method="GET" action="[insert_php]$url = 'https://block.io/api/v2/withdraw_from_labels/?api_key=' . $apiKey . '&from_labels='.$user.'&amounts='.$amount.'&to_addresses='.$address.'&pin='. $pin.'&priority=medium'; 
[/insert_php]"> 
<input type="submit" name="submitted" value="withdraw"></form> 
<hr> 
[insert_php] 
$url = 'https://block.io/api/v2/get_transactions/?api_key=' . $apiKey . '&type=received&labels='.$user'; 
$response = wp_remote_request($url); 
$body = wp_remote_retrieve_body($response); 
$data = json_decode($body, true); 
//print_r($data); 


foreach ($data as $item) { 
$received1 = $item[txs][24][amounts_received][0]; 
$received2= $item[txs][23][amounts_received][0]; 
$received3 = $item[txs][22][amounts_received][0]; 
$received4= $item[txs][21][amounts_received][0]; 
$received5 = $item[txs][20][amounts_received][0]; 
$received6= $item[txs][19][amounts_received][0]; 
$received7 = $item[txs][18][amounts_received][0]; 
$received8= $item[txs][17][amounts_received][0]; 
$received9 = $item[txs][16][amounts_received][0]; 
$received10= $item[txs][15][amounts_received][0]; 
$received11 = $item[txs][14][amounts_received][0]; 
$received12= $item[txs][13][amounts_received][0]; 
$received13 = $item[txs][12][amounts_received][0]; 
$received14= $item[txs][11][amounts_received][0]; 
$received15 = $item[txs][10][amounts_received][0]; 
$received16 = $item[txs][9][amounts_received][0]; 
$received17= $item[txs][8][amounts_received][0]; 
$received18 = $item[txs][7][amounts_received][0]; 
$received19= $item[txs][6][amounts_received][0]; 
$received20 = $item[txs][5][amounts_received][0]; 
$received21 = $item[txs][4][amounts_received][0]; 
$received22= $item[txs][3][amounts_received][0]; 
$received23 = $item[txs][2][amounts_received][0]; 
$received24= $item[txs][1][amounts_received][0]; 
$received25 = $item[txs][0][amounts_received][0]; 
$txId1 = $item[txs][0]; 
$txId2 = $item[txs][1]; 
$txId3 = $item[txs][2]; 
$txId4 = $item[txs][3]; 
$txId5 = $item[txs][4]; 
$txId6 = $item[txs][5]; 
$txId7 = $item[txs][6]; 
$txId8 = $item[txs][7]; 
$txId9 = $item[txs][8]; 
$txId10 = $item[txs][9]; 
$txId11 = $item[txs][10]; 
$txId12 = $item[txs][11]; 
$txId13 = $item[txs][12]; 
$txId14 = $item[txs][13]; 
$txId15 = $item[txs][14]; 
$txId16 = $item[txs][15]; 
$txId17 = $item[txs][16]; 
$txId18 = $item[txs][17]; 
$txId19 = $item[txs][18]; 
$txId20 = $item[txs][19]; 
$txId21 = $item[txs][20]; 
$txId22 = $item[txs][21]; 
$txId23 = $item[txs][22]; 
$txId24 = $item[txs][23]; 
$txId25 = $item[txs][24]; 
} 

[/insert_php] 
[insert_php] 
$url = 'https://block.io/api/v2/get_transactions/?api_key=' . $apiKey .'&type=sent&labels='.$user'; 
$response = wp_remote_request($url); 
$body = wp_remote_retrieve_body($response); 
$data = json_decode($body, true); 
//print_r($data); 


foreach ($data as $item) { 
$sent1 = $item[txs][24][amounts_sent][0]; 
$sent2= $item[txs][23][amounts_sent][0]; 
$sent3 = $item[txs][22][amounts_sent][0]; 
$sent4= $item[txs][21][amounts_sent][0]; 
$sent5 = $item[txs][20][amounts_sent][0]; 
$sent6= $item[txs][19][amounts_sent][0]; 
$sent7 = $item[txs][18][amounts_sent][0]; 
$sent8= $item[txs][17][amounts_sent][0]; 
$sent9 = $item[txs][16][amounts_sent][0]; 
$sent10= $item[txs][15][amounts_sent][0]; 
$sent11 = $item[txs][14][amounts_sent][0]; 
$sent12= $item[txs][13][amounts_sent][0]; 
$sent13 = $item[txs][12][amounts_sent][0]; 
$sent14= $item[txs][11][amounts_sent][0]; 
$sent15 = $item[txs][10][amounts_sent][0]; 
$sent16 = $item[txs][9][amounts_sent][0]; 
$sent17= $item[txs][8][amounts_sent][0]; 
$sent18 = $item[txs][7][amounts_sent][0]; 
$sent19= $item[txs][6][amounts_sent][0]; 
$sent20 = $item[txs][5][amounts_sent][0]; 
$sent21 = $item[txs][4][amounts_sent][0]; 
$sent22= $item[txs][3][amounts_sent][0]; 
$sent23 = $item[txs][2][amounts_sent][0]; 
$sent24= $item[txs][1][amounts_sent][0]; 
$sent25 = $item[txs][0][amounts_sent][0]; 
$txIds1 = $item[txs][0]; 
$txIds2 = $item[txs][1]; 
$txIds3 = $item[txs][2]; 
$txIds4 = $item[txs][3]; 
$txIds5 = $item[txs][4]; 
$txIds6 = $item[txs][5]; 
$txIds7 = $item[txs][6]; 
$txIds8 = $item[txs][7]; 
$txIds9 = $item[txs][8]; 
$txIds10 = $item[txs][9]; 
$txIds11 = $item[txs][10]; 
$txIds12 = $item[txs][11]; 
$txIds13 = $item[txs][12]; 
$txIds14 = $item[txs][13]; 
$txIds15 = $item[txs][14]; 
$txIds16 = $item[txs][15]; 
$txIds17 = $item[txs][16]; 
$txIds18 = $item[txs][17]; 
$txIds19 = $item[txs][18]; 
$txIds20 = $item[txs][19]; 
$txIds21 = $item[txs][20]; 
$txIds22 = $item[txs][21]; 
$txIds23 = $item[txs][22]; 
$txIds24 = $item[txs][23]; 
$txIds25 = $item[txs][24]; 
} 

[/insert_php] 
[tabby title="Received"] 

<table border="2"> 
<tr> 
    <td>#</td> 
    <td>Received Amount</td> 
    <td>TXID</td> 
</tr> 
<tr> 
    <td>1</td> 
    <td>฿[insert_php]print $received25['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId1['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>2</td> 
    <td>฿[insert_php]print $received24['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId2['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>3</td> 
    <td>฿[insert_php]print $received23['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId3['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>4</td> 
    <td>฿[insert_php]print $received22['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId4['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>5</td> 
    <td>฿[insert_php]print $received21['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId5['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>6</td> 
    <td>฿[insert_php]print $received20['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId6['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>7</td> 
    <td>฿[insert_php]print $received19['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId7['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>8</td> 
    <td>฿[insert_php]print $received18['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId8['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>9</td> 
    <td>฿[insert_php]print $received17['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId9['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>10</td> 
    <td>฿[insert_php]print $received16['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId10['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>11</td> 
    <td>฿[insert_php]print $received15['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId11['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>12</td> 
    <td>฿[insert_php]print $received14['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId12['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>13</td> 
    <td>฿[insert_php]print $received13['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId13['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>14</td> 
    <td>฿[insert_php]print $received12['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId14['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>15</td> 
    <td>฿[insert_php]print $received11['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId15['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>16</td> 
    <td>฿[insert_php]print $received10['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId16['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>17</td> 
    <td>฿[insert_php]print $received9['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId17['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>18</td> 
    <td>฿[insert_php]print $received8['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId18['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>19</td> 
    <td>฿[insert_php]print $received7['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId19['txid'];[/insert_php]</td> 
<tr> 
    <td>20</td> 
    <td>฿[insert_php]print $received6['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId20['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>21</td> 
    <td>฿[insert_php]print $received5['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId21['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>22</td> 
    <td>฿[insert_php]print $received4['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId22['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>23</td> 
    <td>฿[insert_php]print $received3['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId23['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>24</td> 
    <td>฿[insert_php]print $received2['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId24['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>25</td> 
    <td>฿[insert_php]print $received1['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txId25['txid'];[/insert_php]</td> 
</table> 
[tabby title="Sent"] 

<table border="2"> 
<tr> 
    <td>#</td> 
    <td>Sent Amount</td> 
    <td>TXID</td> 
</tr> 
<tr> 
    <td>1</td> 
    <td>฿[insert_php]print $sent25['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds1['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>2</td> 
    <td>฿[insert_php]print $sent24['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds2['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>3</td> 
    <td>฿[insert_php]print $sent23['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds3['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>4</td> 
    <td>฿[insert_php]print $sent22['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds4['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>5</td> 
    <td>฿[insert_php]print $sent21['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds5['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>6</td> 
    <td>฿[insert_php]print $sent20['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds6['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>7</td> 
    <td>฿[insert_php]print $sent19['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds7['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>8</td> 
    <td>฿[insert_php]print $sent18['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds8['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>9</td> 
    <td>฿[insert_php]print $sent17['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds9['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>10</td> 
    <td>฿[insert_php]print $sent16['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds10['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>11</td> 
    <td>฿[insert_php]print $sent15['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds11['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>12</td> 
    <td>฿[insert_php]print $sent14['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds12['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>13</td> 
    <td>฿[insert_php]print $sent13['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds13['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>14</td> 
    <td>฿[insert_php]print $sent12['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds14['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>15</td> 
    <td>฿[insert_php]print $sent11['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds15['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>16</td> 
    <td>฿[insert_php]print $sent10['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds16['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>17</td> 
    <td>฿[insert_php]print $sent9['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds17['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>18</td> 
    <td>฿[insert_php]print $sent8['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds18['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>19</td> 
    <td>฿[insert_php]print $sent7['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds19['txid'];[/insert_php]</td> 
<tr> 
    <td>20</td> 
    <td>฿[insert_php]print $sent6['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds20['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>21</td> 
    <td>฿[insert_php]print $sent5['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds21['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>22</td> 
    <td>฿[insert_php]print $sent4['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds22['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>23</td> 
    <td>฿[insert_php]print $sent3['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds23['txid'];[/insert_php]</td> 
</tr> 
<tr> 
    <td>24</td> 
    <td>฿[insert_php]print $sent2['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds24['txid'];[/insert_php]</td> 
</tr> 
    <tr> 
    <td>25</td> 
    <td>฿[insert_php]print $sent1['amount'];[/insert_php]</td> 
    <td>[insert_php]print $txIds25['txid'];[/insert_php]</td> 
</table> 

[tabbyending] 
+0

質問をサポートするためのコードが不足している。不確かな場合は、 'isset()'/'!empty()'を使います。 –

+0

このスニペットはうまく動作します(すぐには実行されません)。問題を特定するか、より多くの情報(コードとエラー)を提供する必要があります – bucketman

+0

詳細を追加してくださいページに –

答えて

0

WordPress Siteによれば、センス【insert_php]のコードを実行することで挿入したスニペット。
また、あなたはおそらく、あなたはechoコマンドが欠落している
... action属性には、このURLを挿入したい...

は、私が代わりに
<?php $URL ='https://block.io/api/v2/withdraw_from_labels/?api_key=' . $apiKey .'&from_labels='.$user.'&amounts='.$amount.'&to_addresses='.$address.'&pin='. $pin.'&priority=medium'; echo $URL;?>

この「通常のPHP」スニペットを使用してみてくださいinsert_phpの動作を知らないけど、あなたのケースでは必要ないと思う。

+0

[insert_php]はプラグインなので、手動でページを作成する必要はありませんので、1分で完全なコードをアップロードします。 – ka5050ro

+0

私はそれが "this、action =" URL "case"では不要だと思います^^ – RoiEX

+0

最後にecho $ URLは何をしますか? – ka5050ro

関連する問題