-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmore.php
More file actions
executable file
·146 lines (131 loc) · 4.19 KB
/
more.php
File metadata and controls
executable file
·146 lines (131 loc) · 4.19 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!--[if IE]><script language="javascript" type="text/javascript" src="./js/flot/excanvas.min.js"></script><![endif]-->
<script type="text/javascript" src="./js/flot/jquery.js"></script>
<script type="text/javascript" src="./js/flot/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="./js/flot/jquery.flot.pie.js"></script>
<title>Stats</title>
<style type="text/css">
html, body {
height: 100%; /* make the percentage height on placeholder work */
}
.message {
padding-left: 50px;
font-size: smaller;
}
#donation {
font-size: smaller;
color: #A9A9A9;
}
</style>
</head>
<body>
<?php
$debug = $_GET['debug'];
include("config.php");
$db = mysql_connect("$host", "$dbuser", "$dbpassword");
mysql_select_db("$database", $db);
$request = "SELECT * FROM `global_stats` ORDER BY `id` DESC";
$result = mysql_query($request,$db);
$time_raw=array();
$hashrate_raw=array();
while($row = mysql_fetch_array($result))
{
$time_raw[] = (int)$row["time"]*1000;
$hashrate_raw[] = (int)$row["hashrate"]/1000;
}
//echo $row["time"];
$time = array_reverse($time_raw);
$hashrate = array_reverse($hashrate_raw);
//for ( $i = 0; $i < sizeof($time); $i++)
//{
// $time[$i] = date("Y-m-d H:i:s", $time[$i]);
//}
function make_pair($time, $hashrate) {
return array($time, $hashrate);
}
$hasharray = array_map('make_pair', $time, $hashrate);
$datapoints = json_encode($hasharray);
if ($_GET[debug] == 1)
{
echo "<h1>Debug enabled!</h1>";
echo "<br>";
echo "<h2>Regular array (Time & Workers):</h2>";
print_r($hasharray);
echo "<h2>JSON encoded:</h2>";
print $datapoints;
}
mysql_free_result($result);
?>
<center>
<h4>Daily</h4>
<div id="day" style="width:90%;height:200px"></div>
<h4>Weekly</h4>
<div id="week" style="width:90%;height:200px"></div>
<h4>Monthly</h4>
<div id="month" style="width:90%;height:200px"></div>
<h4>Anually</h4>
<div id="year" style="width:90%;height:200px"></div>
</center>
<script type="text/javascript">
$(function () {
var d1 = <?PHP echo $datapoints; ?>;
$.plot($("#day"),
[ { data: d1, label: "Hashrate (GH)", color: "<?php echo $hr_color; ?>"} ], {
series: {
lines: { show: true },
points: { show: false }
},
xaxis: {
min: <?PHP echo (time() - 86400)*1000; ?>,
mode: "time",
timeformat: "%H:%M<br>%m/%d"
},
yaxis: { min: 0 , max: <?php echo (max($hashrate) + 5); ?> , tickSize: 10},
grid: { hoverable: false}
});
$.plot($("#week"),
[ { data: d1, label: "Hashrate (GH)", color: "<?php echo $hr_color; ?>"} ], {
series: {
lines: { show: true },
points: { show: false }
},
xaxis: {
min: <?PHP echo (time() - 604800)*1000; ?>,
mode: "time",
timeformat: "%m/%d"
},
yaxis: { min: 0 , max: <?php echo (max($hashrate) + 5); ?> , tickSize: 10},
grid: { hoverable: false }
});
$.plot($("#month"),
[ { data: d1, label: "Hashrate (GH)", color: "<?php echo $hr_color; ?>"} ], {
series: {
lines: { show: true },
points: { show: false }
},
xaxis: {
min: <?PHP echo (time() - 2629743)*1000; ?>,
mode: "time",
timeformat: "%m/%d"
},
yaxis: { min: 0 , max: <?php echo (max($hashrate) + 5); ?> , tickSize: 10},
grid: { hoverable: false }
});
$.plot($("#year"),
[ { data: d1, label: "Hashrate (GH)", color: "<?php echo $hr_color; ?>"} ], {
series: {
lines: { show: true },
points: { show: false }
},
xaxis: {
min: <?PHP echo (time() - 31556926)*1000; ?>,
mode: "time",
timeformat: "%m/%d"
},
yaxis: { min: 0 , max: <?php echo (max($hashrate) + 5); ?> , tickSize: 10},
grid: { hoverable: false }
});
});
</script>