forked from xblau/node-interface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.php
32 lines (25 loc) · 909 Bytes
/
forms.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
defined( 'NODEMON_RUNNING') || die( 'Access denied.' );
function escapeinput( $input ) {
return preg_replace( '/[^A-Za-z0-9]/', '', $input );
}
if( isset( $_POST['formid'] ) ) {
$formid = escapeinput( $_POST['formid'] );
if( $formid == 'broadcast' and $nodeconfig['broadcast'] ) {
$params = array(
escapeinput( $_POST['transaction'] )
);
$response = send_request(
create_request( 'sendrawtransaction', $params ),
$nodeconfig['username'],
$nodeconfig['password'],
$nodeconfig['serverurl']
);
if( $response['error']['message'] ) {
$formresult = '<br><font color="red">Error: ' . $response['error']['message'] . '.</font>';
} else {
$formresult = '<br><font color="green">Broadcasted transaction ' . $response['result'] . '.</font>';
}
}
}
?>