/
mnlist.php
223 lines (195 loc) · 7.26 KB
/
mnlist.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php
include 'config.php';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_PORT => $rpc_port,
CURLOPT_URL => $rpc_url . ":" . $rpc_port,
CURLOPT_USERPWD => $rpc_user . ":" . $rpc_password,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => "{\n\"jsonrpc\": \"1.0\",\n\"id\":\"curltest\",\n\"method\": \"listmasternodes\"\n}",
));
$listmasternodes = curl_exec($curl);
$listmasternodes = json_decode($listmasternodes);
$mnlist = $listmasternodes->{'result'};
curl_close($curl);
?>
<!DOCTYPE html>
<html>
<title>BWS NODE MONITOR</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
html,body,h1,h2,h3,h4,h5 {font-family: "Raleway", sans-serif}
</style>
<body class="w3-light-grey">
<!-- Top container -->
<div class="w3-bar w3-top w3-black w3-large" style="z-index:4">
<span class="w3-bar-item w3-right"><b>bws_monitor</b> | <?php print $version; ?></span>
</div>
<!-- !PAGE CONTENT! -->
<div class="w3-main" style="margin-top:23px;">
<!-- Header -->
<?php include 'header.php'; ?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["address"])) {
$addressErr = "<b>Address is required</b>";
}
else {
$address = test_input($_POST["address"]);
if (!preg_match("/^[a-zA-Z0-9 ]*$/",$address)) {
$addressErr = "<b>Bad address</b>";
}
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<div class="w3-container w3-padding">
<h4>Check Masternode</h4>
Address : <input type="text" name="address" size="42" class="w3-border w3-padding" value="<?php echo $address; ?>">
<span class="error">*</span>
<button type="submit" name="submit" value="Submit" class="w3-button w3-dark-grey">Find <i class="fa fa-arrow-right"></i></button>
<?php echo $addressErr;?>
</div>
</form>
<?php
if(!empty($_POST["address"])){
echo '<div class="w3-container w3-padding">';
echo "<h4>Masternode Found:</h4>";
for ($i = 0; $i < count($mnlist); $i++) {
if($mnlist[$i]->{'addr'} == ($_POST["address"]))
{
echo '<table class="w3-table w3-striped w3-bordered w3-border w3-hoverable w3-white">';
echo '<tr>';
echo '<td><b>Rank</b></td>';
echo '<td><b>Status</b></td>';
echo '<td><b>Address</b></td>';
echo '<td><b>Last Seen</b></td>';
echo '<td><b>Last Paid</b></td>';
echo '<td><b>Active Time</b></td>';
echo '</tr>'; echo "<tr>";
echo "<td>" . $mnlist[$i]->{'rank'} . "</td>";
echo "<td>" . $mnlist[$i]->{'status'} . "</td>";
echo "<td><a href=http://" . $bws_explorer . "/address/" . $mnlist[$i]->{'addr'} .">" . $mnlist[$i]->{'addr'} . "</a></td>";
echo "<td>" . date($date_format, $mnlist[$i]->{'lastseen'}) . "</td>";
if($mnlist[$i]->{'lastpaid'} == 0){echo "<td>Not yet</td>";}
else{echo "<td>" . date($date_format, $mnlist[$i]->{'lastpaid'}) . "</td>";}
echo "<td>" . number_format(($mnlist[$i]->{'activetime'} / 86400), 0) . " days</td>";
echo "</tr>";
echo "</table>";
}
}
echo "</div>";
}
?>
<?php
if(!empty($custom_mnlist[0])){
echo '<div class="w3-container w3-padding">';
echo "<h4>My Masternodes :</h4>";
echo '<table class="w3-table w3-striped w3-bordered w3-border w3-hoverable w3-white">';
echo '<tr>';
echo '<td><b>Rank</b></td>';
echo '<td><b>Status</b></td>';
echo '<td><b>Address</b></td>';
echo '<td><b>Last Seen</b></td>';
echo '<td><b>Last Paid</b></td>';
echo '<td><b>Active Time</b></td>';
echo '</tr>';
for ($i = 0; $i < count($mnlist); $i++) {
if(in_array($mnlist[$i]->{'addr'}, $custom_mnlist))
{
echo "<tr>";
echo "<td>" . $mnlist[$i]->{'rank'} . "</td>";
echo "<td>" . $mnlist[$i]->{'status'} . "</td>";
echo "<td><a href=http://" . $bws_explorer . "/address/" . $mnlist[$i]->{'addr'} .">" . $mnlist[$i]->{'addr'} . "</a></td>";
echo "<td>" . date($date_format, $mnlist[$i]->{'lastseen'}) . "</td>";
if($mnlist[$i]->{'lastpaid'} == 0){
echo "<td>Not yet</td>";
}
else{
echo "<td>" . date($date_format, $mnlist[$i]->{'lastpaid'}) . "</td>";
}
echo "<td>" . number_format(($mnlist[$i]->{'activetime'} / 86400), 0) . " days</td>";
echo "</tr>";
}
}
echo "</table>";
echo "</div>";
}
else{
echo '<div class="w3-container w3-padding">';
echo '<table>';
echo "<h4>My Masternodes :</h4>";
echo '<table class="w3-table w3-striped w3-bordered w3-border w3-hoverable w3-orange">';
echo '<tr>';
echo '<td>Make your own list by adding each addresses in <b>config.php</b>:<br><b>$custom_mnlist = array("ADDR1", "ADDR2", "ADDR3");</b></td>';
echo '</tr>';
echo "</table>";
echo "</div>";
}
?>
<?php if(!empty($mnlist)){
echo '<div id="mnlist" class="w3-container">';
echo '<h4>All Masternodes :</h4>';
echo '<table class="w3-table w3-striped w3-bordered w3-border w3-hoverable w3-white">';
echo '<tr>';
echo '<td><b>Rank</b></td>';
echo '<td><b>Status</b></td>';
echo '<td><b>Address</b></td>';
echo '<td><b>Last Seen</b></td>';
echo '<td><b>Last Paid</b></td>';
echo '<td><b>Active Time</b></td>';
echo '</tr>';
for ($i = 0; $i < count($mnlist); $i++) {
echo "<tr>";
echo "<td>" . $mnlist[$i]->{'rank'} . "</td>";
echo "<td>" . $mnlist[$i]->{'status'} . "</td>";
echo "<td><a href=http://" . $bws_explorer . "/address/" . $mnlist[$i]->{'addr'} .">" . $mnlist[$i]->{'addr'} . "</a></td>";
echo "<td>" . date($date_format, $mnlist[$i]->{'lastseen'}) . "</td>";
if($mnlist[$i]->{'lastpaid'} == 0){echo "<td>Not yet</td>";}
else{echo "<td>" . date($date_format, $mnlist[$i]->{'lastpaid'}) . "</td>";}
echo "<td>" . number_format(($mnlist[$i]->{'activetime'} / 86400), 0) . " days</td>";
echo "</tr>";
}
echo '</table><br>';
echo '</div>';
}
?>
<!-- Footer -->
<footer class="w3-container w3-padding-16 w3-dark-grey">
<h5 class="w3-bottombar w3-border-blue">Support BWS</h5>
<p>Source code on <a href="https://github.com/mining4altcoins/bws_monitor" target="_blank">GitHub</a></p>
<p>BWS Links :
<a href="http://217.163.23.222:3000">Explorer</a> |
<a href="https://discord.gg/Vng6uyK">Discord</a> |
<a href="https://t.me/bitcoinwspectrum">Telegram</a> |
<a href="https://bitcoinwspectrum.com/">Website</a> |
</p>
</footer>
<script>
function loadlink(){
$( "#status" ).load( "status.php" );
$( "#connectioncount" ).load( "connectioncount.php" );
$( "#blockcount" ).load( "blockcount.php" );
$( "#balance" ).load( "balance.php" );
}
loadlink(); // This will run on page load
setInterval(function(){
loadlink() // this will run after every 5 seconds
}, 1000);
</script>
<!-- End page content -->
</div>
</body>
</html>