forked from mikeallisonJS/simplecoin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasherbot.php
More file actions
61 lines (45 loc) · 1.88 KB
/
asherbot.php
File metadata and controls
61 lines (45 loc) · 1.88 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
<?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
*/
//Asher's PHP Stats File
include ("includes/requiredFunctions.php");
/*
Outputs
Total Hashrate
Number of Users Mining
Last Time Block Found
Who Found Last Block
*/
//Total Hashrate
$hashrate = round($stats->currenthashrate()/1000,1)or sqlerr(__FILE__,__LINE__);
//Number of Users Mining
$users = count($stats->userhashrates());
//Who Found Last Block + Last Time Block Found + Block Number
$result = mysql_query("SELECT blockNumber, username, time FROM share WHERE upstream_result = 'Y' ORDER BY id DESC LIMIT 1");
if ($resultrow = mysql_fetch_object($result)) {
$blocknumber = $resultrow->blockNumber;
$blocktime = $resultrow->time;
$solvedby = $resultrow->username;
}
$result = mysql_query("SELECT id,confirms FROM networkBlocks WHERE confirms >= 1 ORDER BY blockNumber DESC LIMIT 1");
if ($resultrow = mysql_fetch_object($result)) {
$confirms = $resultrow->confirms;
}
$timediff = time() - strtotime($blocktime);
$solved = explode(".", $solvedby);
echo $hashrate."g-".$users."-".$blocknumber."-".$timediff."-".$solved[0]."-".$confirms;
?>