This repository has been archived by the owner on May 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
my_stats.php
130 lines (97 loc) · 5.24 KB
/
my_stats.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
<?php
// Improved Stats written by Tom Lightspeed ([email protected] + 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=\"/\">Simplecoin.us</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 "<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>";
//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>";
//echo "</div><div class=\"clear\"></div><div id=\"stats_wrap_5\" class=\"top_spacing\">";
}
echo "<div class=\"clear\"></div></div>";
include("includes/footer.php");
?>