forked from Someguy123/-Coin
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbtc.php
197 lines (195 loc) · 3.48 KB
/
btc.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
<?php
/**
* @author Chris S - AKA Someguy123
* @version 0.01 (ALPHA!)
* @license PUBLIC DOMAIN http://unlicense.org
* @package +Coin - Bitcoin & forks Web Interface
*/
ini_set("display_errors", false);
$pageid = 3;
include ("header.php");
$trans = $nmc->listtransactions('*', 100);
$x = array_reverse($trans);
$bal = $nmc->getbalance("*", 6); // confirmed balance of wallet
$bal3 = $nmc->getbalance("*", 0); // unconfirmed balance of wallet
$bal2 = $bal - $bal3; // unconfirmed transactions underway
$pbal = number_format($bal,8);
$pbal2 = number_format($bal2,8);
$pbal3 = number_format($bal3,8);
echo "
<div class='content'>
<div class='span5'>
<h3>Confirmed Balance: <font color='green'>{$pbal} BTC</font></h3>
<h4>Unconfirmed Balance: <font color='red'>{$pbal3} BTC</font></h4>
<h4>Awaiting Confirmation: <font color='red'>{$pbal2} BTC</font></h4>
</div>
<div class='span5'>
<a href='?orphan=1'>
View Orphans
</a><br>
<a href='btc.php'>
Go back
</a>
</div>
<table class='table-striped table-bordered table'>
<thead>
<tr>
<th>
Method
</th>
<th>
Address
</th>
<th>
Name
</th>
<th>
Account
</th>
<th>
Amount
</th>
<th>
Confirmations
</th>
<th>
Time
</th>
</tr>
</thead>
";
// Load address book
$addresses_arr = array();
$addressbook = file("addressbook.csv");
foreach ($addressbook as $line)
{
$values = explode(";", $line);
$address = $values[0];
$name = str_replace("\n", "", $values[1]);
$addresses_arr[$address] = $name;
}
// Load my addresses
$myaddresses = file("myaddresses.csv");
foreach ($myaddresses as $line)
{
$values = explode(";", $line);
$address = $values[0];
$name = str_replace("\n", "", $values[1]);
$addresses_arr[$address] = $name;
}
foreach ($x as $x)
{
if($x['amount'] > 0) { $coloramount = "green"; } else { $coloramount = "red"; }
if (in_array('confirmations', $x))
{
if($x['confirmations'] >= 6) { $colorconfirms = "green"; } else { $colorconfirms = "red"; }
}
if (!isset($_POST['orphan']))
{
$date = date(DATE_RFC822, $x['time']);
echo "
<tr>
<tr>
<td>
" . ucfirst($x['category']) . "
</td>
";
if (isset($x['address']))
{
echo "
<td>
{$x['address']}
</td>
<td>
";
if (in_array($x['address'], $addresses_arr))
{
echo "{$addresses_arr[$x['address']]}";
}
echo "
</td>
";
if (isset($x['label']))
{
echo "
<td>
\"{$x['label']}\"
</td>
";
}
}
else
{
echo "
<td style='text-align: center'>
Generated
</td>
<td>
N/A
</td>
<td>
N/A
</td>
";
}
echo "
<td>
<font color='{$coloramount}'>
{$x['amount']}
</font>
</td>
<td>
<font color='{$colorconfirms}'>
";
if (isset($x['address']))
{
echo "{$x['confirmations']}";
}
echo "
</font>
</td>
<td>
{$date}
</td>
</tr>";
}
else
{
$date = date(DATE_RFC822, $x['time']);
if ($x['category'] == "orphan")
{
echo "
<tr>
<td>
";
if (isset($x['label']))
{
echo "
{$x['label']}
";
}
echo "
</td>
<td>
{$x['amount']}
</td>
<td>
{$x['confirmations']}
</td>
<td>
{$x['category']}
</td>
<td>
{$date}
</td>
</tr>
";
}
}
}
echo "
</table>
";
//print_r($x);
include("footer.php");
?>