-
Notifications
You must be signed in to change notification settings - Fork 11
/
cf-commands.php
executable file
·66 lines (56 loc) · 2.01 KB
/
cf-commands.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
include ("header.php");
include ("pass.php");
$input = explode(' ', $_POST['order'], 2);
$command = $input[0];
switch ($command) {
case "createproposal":
try {
list($address, $nav, $time, $description) = explode(' ',$input[1], 4);
$nav = (int)$nav;
$time = (int)$time;
$firstCharacter = substr($description, 0,1);
$lastCharacter = substr($description, -1);
if ($firstCharacter == '"') {
$description = substr($description, 1);
}
if ($lastCharacter == '"') {
$description = substr($description, 0, -1);
}
echo("<p><b>$command $address $nav $time $description</b></p>");
printarray($coin->$command($address, $nav, $time, $description));
} catch(Exception $e) {
echo "<p class='bg-danger'><b>{$e}Error: Something went wrong... Double check for spelling error and correct syntax. </b></p>";
}
break;
case "createpaymentrequest":
try {
list($hash, $nav, $unique_id) = explode(' ',$input[1], 3);
$nav = (int)$nav;
$firstCharacter = substr($unique_id, 0,1);
$lastCharacter = substr($unique_id, -1);
if ($firstCharacter == '"') {
$unique_id = substr($unique_id, 1);
}
if ($lastCharacter == '"') {
$unique_id = substr($unique_id, 0, -1);
}
echo("<p><b>$command $hash $nav $unique_id</b></p>");
printarray($coin->$command($hash, $nav, $unique_id));
} catch(Exception $e) {
echo "<p class='bg-danger'><b>{$e}Error: Something went wrong... Double check for spelling error and correct syntax. </b></p>";
}
break;
case "proposalvote":
case "paymentrequestvote":
try {
list($hash, $option) = explode(' ', $input[1]);
echo("<p><b>$command $hash $option</b></p>");
printarray($coin->$command($hash, $option));
} catch(Exception $e) {
echo "<p class='bg-danger'><b>{$e}Error: Something went wrong... Double check for spelling error and correct syntax. </b></p>";
}
break;
}
?>
<?php include ("footer.php");?>