-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_listmasternodes.php
77 lines (71 loc) · 3.16 KB
/
index_listmasternodes.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
67
68
69
70
71
72
73
74
75
76
77
<?PHP
header('Content-Type: application/json');
if (strtolower($_GET['state']) == "enabled") {
$jsonData = file_get_contents('listmasternodes_enabled.json');
if ($_GET['count'] == "True") {
$data = json_decode($jsonData,true);
$output['ENABLED'] = 0;
foreach ($data as $value) { if ($value["state"] == "ENABLED"){ $output['ENABLED'] = $output['ENABLED']+1; } }
echo json_encode($output);
}
else { echo $jsonData; }
}
else if (strtolower($_GET['state']) == "pre_enabled") {
$jsonData = file_get_contents('listmasternodes_pre_enabled.json');
if ($_GET['count'] == "True") {
$data = json_decode($jsonData,true);
$output['PRE_ENABLED'] = 0;
foreach ($data as $value) { if ($value["state"] == "PRE_ENABLED"){ $output['PRE_ENABLED'] = $output['PRE_ENABLED']+1; } }
echo json_encode($output);
}
else { echo $jsonData; }
}
else if (strtolower($_GET['state']) == "pre_resigned") {
$jsonData = file_get_contents('listmasternodes_pre_resigned.json');
if ($_GET['count'] == "True") {
$data = json_decode($jsonData,true);
$output['PRE_RESIGNED'] = 0;
foreach ($data as $value) { if ($value["state"] == "PRE_RESIGNED"){ $output['PRE_RESIGNED'] = $output['PRE_RESIGNED']+1; } }
echo json_encode($output);
}
else { echo $jsonData; }
}
else if (strtolower($_GET['state']) == "resigned") {
$jsonData = file_get_contents('listmasternodes_resigned.json');
if ($_GET['count'] == "True") {
$data = json_decode($jsonData,true);
$output['RESIGNED'] = 0;
foreach ($data as $value) { if ($value["state"] == "RESIGNED"){ $output['RESIGNED'] = $output['RESIGNED']+1; } }
echo json_encode($output);
}
else {echo $jsonData;}
}
else if (strtolower($_GET['state']) == "transferring") {
$jsonData = file_get_contents('listmasternodes_transferring.json');
if ($_GET['count'] == "True") {
$data = json_decode($jsonData,true);
$output['TRANSFERRING'] = 0;
foreach ($data as $value) { if ($value["state"] == "TRANSFERRING"){ $output['TRANSFERRING'] = $output['TRANSFERRING']+1; } }
echo json_encode($output);
}
else {echo $jsonData;}
}
else {
$jsonData = file_get_contents('listmasternodes.json');
if ($_GET['count'] == "True") {
$data = json_decode($jsonData,true);
$output['ENABLED'] = 0;
$output['PRE_ENABLED'] = 0;
$output['RESIGNED'] = 0;
$output['PRE_RESIGNED'] = 0;
$output['TRANSFERRING'] = 0;
foreach ($data as $value) {
if ($value["state"] == "ENABLED") { $output['ENABLED'] = $output['ENABLED']+1; }
else if ($value["state"] == "PRE_ENABLED") { $output['PRE_ENABLED'] = $output['PRE_ENABLED']+1; }
else if ($value["state"] == "RESIGNED") { $output['RESIGNED'] = $output['RESIGNED']+1; }
else if ($value["state"] == "PRE_RESIGNED") { $output['PRE_RESIGNED'] = $output['PRE_RESIGNED']+1; }
else if ($value["state"] == "TRANSFERRING") { $output['TRANSFERRING'] = $output['TRANSFERRING']+1; }}
echo json_encode($output);}
else {echo $jsonData;}
}
?>