admin panel pool-workers
This commit is contained in:
parent
21a378aac1
commit
aeaeb32d4a
@ -176,6 +176,40 @@ class Worker {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch all workers for admin panel
|
||||||
|
* @param limit int
|
||||||
|
* @return mixed array Workers and their settings or false
|
||||||
|
**/
|
||||||
|
public function getAllWorkers($iLimit=0) {
|
||||||
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
|
$stmt = $this->mysqli->prepare("
|
||||||
|
SELECT id, username, password, monitor, difficulty,
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536 / 600 / 1000), 0), 0) AS hashrate
|
||||||
|
FROM " . $this->share->getTableName() . "
|
||||||
|
WHERE
|
||||||
|
username = w.username
|
||||||
|
AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
|
||||||
|
) + (
|
||||||
|
SELECT
|
||||||
|
IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536 / 600 / 1000), 0), 0) AS hashrate
|
||||||
|
FROM " . $this->share->getArchiveTableName() . "
|
||||||
|
WHERE
|
||||||
|
username = w.username
|
||||||
|
AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
|
||||||
|
) AS hashrate
|
||||||
|
FROM $this->table AS w
|
||||||
|
ORDER BY hashrate DESC LIMIT ?");
|
||||||
|
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iLimit) && $stmt->execute() && $result = $stmt->get_result())
|
||||||
|
return $result->fetch_all(MYSQLI_ASSOC);
|
||||||
|
// Catchall
|
||||||
|
$this->setErrorMessage('Failed to fetch workers');
|
||||||
|
$this->debug->append('Fetching workers failed: ' . $this->mysqli->error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all currently active workers in the past 10 minutes
|
* Get all currently active workers in the past 10 minutes
|
||||||
* @param none
|
* @param none
|
||||||
|
|||||||
18
public/include/pages/admin/poolworkers.inc.php
Normal file
18
public/include/pages/admin/poolworkers.inc.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
// Make sure we are called from index.php
|
||||||
|
if (!defined('SECURITY')) die('Hacking attempt');
|
||||||
|
|
||||||
|
// Check user to ensure they are admin
|
||||||
|
if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
||||||
|
header("HTTP/1.1 404 Page not found");
|
||||||
|
die("404 Page not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
$iActiveWorkers = $worker->getCountAllActiveWorkers();
|
||||||
|
$aWorkers = $worker->getAllWorkers($iActiveWorkers);
|
||||||
|
|
||||||
|
$smarty->assign('WORKERS', $aWorkers);
|
||||||
|
|
||||||
|
$smarty->assign('CONTENT', 'default.tpl');
|
||||||
|
|
||||||
|
?>
|
||||||
34
public/templates/mmcFE/admin/poolworkers/default.tpl
Normal file
34
public/templates/mmcFE/admin/poolworkers/default.tpl
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{include file="global/block_header.tpl" BLOCK_HEADER="{count($WORKERS)} Current Active Pool Workers"}
|
||||||
|
<center>
|
||||||
|
<table border="0" style="font-size:13px;">
|
||||||
|
<thead>
|
||||||
|
<tr style="background-color:#B6DAFF;">
|
||||||
|
<th>Worker Name</th>
|
||||||
|
<th>Password</th>
|
||||||
|
<th class="center">Active</th>
|
||||||
|
{if $GLOBAL.config.disable_notifications != 1}<th class="center">Monitor</th>{/if}
|
||||||
|
<th class="right">Khash/s</th>
|
||||||
|
<th class="right">Difficulty</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
{nocache}
|
||||||
|
{section worker $WORKERS}
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>{$WORKERS[worker].username|escape}</td>
|
||||||
|
<td>{$WORKERS[worker].password|escape}</td>
|
||||||
|
<td class="center"><img src="{$PATH}/images/{if $WORKERS[worker].hashrate > 0}success{else}error{/if}.gif" /></td>
|
||||||
|
{if $GLOBAL.config.disable_notifications != 1}
|
||||||
|
<td class="center">
|
||||||
|
<img src="{$PATH}/images/{if $WORKERS[worker].monitor}success{else}error{/if}.gif" />
|
||||||
|
</td>
|
||||||
|
{/if}
|
||||||
|
<td class="right">{$WORKERS[worker].hashrate|number_format|default:"0"}</td>
|
||||||
|
<td class="right">{if $WORKERS[worker].hashrate > 0}{$WORKERS[worker].difficulty|number_format:"2"|default:"0"}{else}0{/if}</td>
|
||||||
|
</tr>
|
||||||
|
{/section}
|
||||||
|
{/nocache}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</center>
|
||||||
|
{include file="global/block_footer.tpl"}
|
||||||
@ -21,6 +21,7 @@
|
|||||||
<li><a href="{$smarty.server.PHP_SELF}?page=admin&action=transactions">Transactions</a></li>
|
<li><a href="{$smarty.server.PHP_SELF}?page=admin&action=transactions">Transactions</a></li>
|
||||||
<li><a href="{$smarty.server.PHP_SELF}?page=admin&action=settings">Settings</a></li>
|
<li><a href="{$smarty.server.PHP_SELF}?page=admin&action=settings">Settings</a></li>
|
||||||
<li><a href="{$smarty.server.PHP_SELF}?page=admin&action=news">News</a></li>
|
<li><a href="{$smarty.server.PHP_SELF}?page=admin&action=news">News</a></li>
|
||||||
|
<li><a href="{$smarty.server.PHP_SELF}?page=admin&action=poolworkers">Pool Workers</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
31
public/templates/mpos/admin/poolworkers/default.tpl
Normal file
31
public/templates/mpos/admin/poolworkers/default.tpl
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<article class="module width_3_quarter">
|
||||||
|
<header><h3>{count($WORKERS)} Current Active Pool Workers</h3></header>
|
||||||
|
<table class="tablesorter" cellspacing="0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th align="left">Worker Name</th>
|
||||||
|
<th align="left">Password</th>
|
||||||
|
<th align="center">Active</th>
|
||||||
|
{if $GLOBAL.config.disable_notifications != 1}<th align="center">Monitor</th>{/if}
|
||||||
|
<th align="right">Khash/s</th>
|
||||||
|
<th align="right" style="padding-right: 25px;">Difficulty</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
{nocache}
|
||||||
|
{section worker $WORKERS}
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td align="left">{$WORKERS[worker].username|escape}</td>
|
||||||
|
<td align="left">{$WORKERS[worker].password|escape}</td>
|
||||||
|
<td align="center"><i class="icon-{if $WORKERS[worker].hashrate > 0}ok{else}cancel{/if}"></i></td>
|
||||||
|
{if $GLOBAL.config.disable_notifications != 1}
|
||||||
|
<td align="center"><i class="icon-{if $WORKERS[worker].monitor}ok{else}cancel{/if}"></i></td>
|
||||||
|
{/if}
|
||||||
|
<td align="right">{$WORKERS[worker].hashrate|number_format|default:"0"}</td>
|
||||||
|
<td align="right" style="padding-right: 25px;">{if $WORKERS[worker].hashrate > 0}{$WORKERS[worker].difficulty|number_format:"2"|default:"0"}{else}0{/if}</td>
|
||||||
|
</tr>
|
||||||
|
{/section}
|
||||||
|
{/nocache}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</article>
|
||||||
@ -22,6 +22,7 @@
|
|||||||
<li class="icon-exchange"><a href="{$smarty.server.PHP_SELF}?page=admin&action=transactions">Transactions</a></li>
|
<li class="icon-exchange"><a href="{$smarty.server.PHP_SELF}?page=admin&action=transactions">Transactions</a></li>
|
||||||
<li class="icon-cog"><a href="{$smarty.server.PHP_SELF}?page=admin&action=settings">Settings</a></li>
|
<li class="icon-cog"><a href="{$smarty.server.PHP_SELF}?page=admin&action=settings">Settings</a></li>
|
||||||
<li class="icon-doc"><a href="{$smarty.server.PHP_SELF}?page=admin&action=news">News</a></li>
|
<li class="icon-doc"><a href="{$smarty.server.PHP_SELF}?page=admin&action=news">News</a></li>
|
||||||
|
<li class="icon-photo"><a href="{$smarty.server.PHP_SELF}?page=admin&action=poolworkers">Pool Workers</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{/if}
|
{/if}
|
||||||
{if $smarty.session.AUTHENTICATED|default}
|
{if $smarty.session.AUTHENTICATED|default}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user