-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6928dd2
commit d5bbf67
Showing
2 changed files
with
25 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
.idea | ||
config.php | ||
|
||
/vendor/ | ||
/twig_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,39 @@ | ||
<?php | ||
|
||
// What page/algo we are on | ||
$algo = 'bitcore'; | ||
// Add autoload | ||
require __DIR__ . '/vendor/autoload.php'; | ||
|
||
// Connect mysql | ||
$conn = include('config.php'); | ||
$conn = include_once('config.php'); | ||
|
||
/** | ||
* Helper class | ||
* @var minerHelper.php | ||
*/ | ||
include_once('minerHelper.php'); | ||
|
||
// What page/algo we are on | ||
$algo = 'bitcore'; | ||
|
||
// Gets data for specific miner address | ||
$miner_address = $_GET['address'] ?? ""; | ||
|
||
$loader = new Twig_Loader_Filesystem(__DIR__ . '/templates'); | ||
$twig = new Twig_Environment($loader, [ | ||
'cache' => __DIR__ . '/twig_cache', | ||
// 'auto_reload' => true // Should be turned off on production | ||
]); | ||
|
||
// Get workers for miner address | ||
$workers = minerHelper::getWorkers($conn, $miner_address); | ||
foreach ($workers as $worker) { | ||
print 'Version: ' . $worker['version']; | ||
|
||
foreach ($workers as $key => $worker) { | ||
$hashrate = minerHelper::getHashrate($conn, $algo, $worker['version'], $worker['name']); | ||
print ' - hashrate: ' . minerHelper::Itoa2($hashrate['hashrate']) . 'h/s'; | ||
print '<br />'; | ||
$workers[$key]['hashrate'] = minerHelper::Itoa2($hashrate['hashrate']) . 'h/s'; | ||
} | ||
|
||
// Return TWIG template | ||
print $twig->render('index.html.twig', [ | ||
'name' => 'Greg', | ||
'workers' => $workers | ||
]); |