forked from mikeallisonJS/simplecoin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy_stats.php
More file actions
153 lines (113 loc) · 6.13 KB
/
my_stats.php
File metadata and controls
153 lines (113 loc) · 6.13 KB
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
<?php
/*
Copyright (C) 2013 Jesse B. Crawford
This file is part of SimpleBTC.
SimpleBTC is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SimpleBTC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
SimpleBTC (overhaul) Developer: 16LJ4z5BzZpDTzXBL2n34o8Me6WAM2RhLd
SimpleCoin (unmaintained original) Developer: 1Fc2ScswXAHPUgj3qzmbRmwWJSLL2yv8Q
*/
// Improved Stats written by Tom Lightspeed (tomlightspeed@gmail.com + http://facebook.com/tomlightspeed)
// Developed Socially for http://ozco.in
// If you liked my work, want changes/etc please contact me or donate 16p56JHwLna29dFhTRcTAurj4Zc2eScxTD.
// Special thanks to WAYNO, GRAET & YCROS from #ozcoin on freenode.net for their help :-)
// May the force be with you.
$pageTitle = "- My Stats";
include ("includes/header.php");
//DELETE
error_reporting(E_ALL);
ini_set('display_errors', '1');
echo "<div id=\"stats_wrap\">";
if( !$cookieValid ){
echo "<div id='new_user_message'><p>Welcome to <a href='/'>".$config['site']['poolname']."</a>! Please login or <a href='register.php'>join us</a> to get detailed stats and graphs relating to your hashing!</p></div>";
}
else
{
// SHOW USER TOTAL PAID *************************************************************************************************************************
echo "<table class=\"money_table server_width\">";
echo "<tr><th scope=\"col\" colspan=\"2\">Total BTC Earned</th></tr><tr class=\"moneyheader\"><td class=\"bitcoin_image\"><img class=\"earned_coin\" src=\"/images/bitcoin.png\" /></td><td class=\"bitcoins\">";
$result = mysql_query_cache("SELECT paid + balance as amount_earned FROM accountBalance WHERE userid = $userInfo->id");
if ($resultrow = $result[0]) {
echo $resultrow->amount_earned;
}
echo "</td></tr></table>";
// USER HASHRATE LAST HOUR/TIME GRAPH *************************************************************************************************************************
// http://www.filamentgroup.com/lab/update_to_jquery_visualize_accessible_charts_with_html5_from_designing_with/
// table is hidden, graph follows
// echo "<table id=\"user_hashrate_lasthour\" class=\"hide\">";
// echo "<caption>" . $userInfo->username . "'s Hashrate over the Last Hour</caption>";
// echo "<thead><tr><td></td>";
//
// $query = "SELECT DISTINCT DATE_FORMAT(timestamp, '%h:%i') as time, hashrate FROM userHashrates WHERE timestamp > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 HOUR) AND userId = $userInfo->id";
// $result = mysql_query($query);
//
// while($resultrow = mysql_fetch_object($result)) {
// echo "<th scope=\"col\">" . $resultrow->time . "</th>";
// }
//
// echo "</thead><tbody><tr><th scope=\"row\">" . $userInfo->username . "'s Hashrate</th>";
//
// // re-iterate through results
// if (mysql_num_rows($result) > 0)
// mysql_data_seek($result, 0);
//
// while($resultrow = mysql_fetch_object($result)) {
// echo "<td>" . $resultrow->hashrate . "</td>";
// }
//
// echo "</tbody></table>";
//echo "</div><div class=\"clear\"></div><div id=\"stats_wrap_3\" class=\"top_spacing\">";
// USER HASHRATE LAST 24 HOURS/TIME GRAPH *************************************************************************************************************************
// http://www.filamentgroup.com/lab/update_to_jquery_visualize_accessible_charts_with_html5_from_designing_with/
// table is hidden, graph follows
echo "\n<br /><table id=\"user_hashrate_last24\" class=\"hide\">";
echo "<caption>" . $userInfo->username . "'s Hashrate over the Last 24 Hours</caption>";
echo "<thead><tr><td></td>";
$query = "SELECT DATE_FORMAT(timestamp, '%l:%i') as time, hashrate FROM userHashrates WHERE timestamp > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 24 HOUR) AND userId = $userInfo->id";
$query .= " GROUP BY EXTRACT(DAY FROM timestamp), EXTRACT(HOUR FROM timestamp)";
$result = mysql_query_cache($query);
foreach ($result as $resultrow) {
echo "<th scope=\"col\">" . $resultrow->time . "</th>";
}
echo "</thead><tbody><tr><th scope=\"row\">".$userInfo->username."'s Hashrate</th>";
// re-iterate through results
//if (mysql_num_rows($result) > 0)
// mysql_data_seek($result, 0);
foreach ($result as $resultrow) {
echo "<td>".$resultrow->hashrate."</td>";
}
echo "</tbody></table><br />\n";
//echo "</div><div class=\"clear\"></div><div id=\"stats_wrap_4\" class=\"top_spacing\">";
// USER HASHRATE OVER LAST MONTH GRAPH *************************************************************************************************************************
// http://www.filamentgroup.com/lab/update_to_jquery_visualize_accessible_charts_with_html5_from_designing_with/
// table is hidden, graph follows
echo "<table id=\"user_hashrate_lastmonth\" class=\"hide\">";
echo "<caption>" . $userInfo->username . "'s Hashrate over the Last Month</caption>";
echo "<thead><tr><td></td>";
$query = "SELECT DATE_FORMAT(timestamp, '%b %e') as day, hashrate FROM userHashrates WHERE timestamp > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 MONTH) AND userId = " . $userInfo->id;
$query .= " GROUP BY EXTRACT(MONTH FROM timestamp), EXTRACT(DAY FROM timestamp)";
$result = mysql_query_cache($query);
foreach ($result as $resultrow) {
echo "<th scope=\"col\">" . $resultrow->day . "</th>";
}
echo "</thead><tbody><tr><th scope=\"row\">" . $userInfo->username . "'s Hashrate</th>";
// re-iterate through results
//if (mysql_num_rows($result) > 0)
// mysql_data_seek($result, 0);
foreach ($result as $resultrow) {
echo "<td>" . $resultrow->hashrate . "</td>";
}
echo "</tbody></table><br />\n";
//echo "</div><div class=\"clear\"></div><div id=\"stats_wrap_5\" class=\"top_spacing\">";
}
echo "<div class=\'clear'></div></div><br />\n";
include("includes/footer.php");
?>