Merge pull request #46 from TheSerapher/next

Next to Master
This commit is contained in:
Sebastian Grewe 2013-05-22 11:53:20 -07:00
commit 16edddf639
6 changed files with 35 additions and 12 deletions

View File

@ -16,6 +16,13 @@ future.
I do not recommend using this for a live setup as of yet. Wait for the later Release Candidate
if you wish to run your pool with it. Testing pools are much appreciated though!
Donations
=========
I was hoping to keep this out of the README but apparently people remove or change the LTC address
at the bottom of the page. For those of you finding my project and are willing to appreciate the work
with some hard earned LTC feel free to donate to my LTC address: `Lge95QR2frp9y1wJufjUPCycVsg5gLJPW8`
Requirements
============

View File

@ -8,11 +8,12 @@ class Worker {
private $sError = '';
private $table = 'workers';
public function __construct($debug, $mysqli, $user, $share) {
public function __construct($debug, $mysqli, $user, $share, $config) {
$this->debug = $debug;
$this->mysqli = $mysqli;
$this->user = $user;
$this->share = $share;
$this->config = $config;
$this->debug->append("Instantiated Worker class", 2);
}
@ -63,7 +64,7 @@ class Worker {
$stmt = $this->mysqli->prepare("
SELECT id, username, password,
( SELECT SIGN(COUNT(id)) FROM " . $this->share->getTableName() . " WHERE username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS active,
( SELECT ROUND(COUNT(id) * POW(2,21)/600/1000) FROM " . $this->share->getTableName() . " WHERE username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS hashrate
( SELECT ROUND(COUNT(id) * POW(2, " . $this->config['difficulty'] . ")/600/1000) FROM " . $this->share->getTableName() . " WHERE username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS hashrate
FROM $this->table
WHERE account_id = ?");
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $account_id) && $stmt->execute() && $result = $stmt->get_result())
@ -138,4 +139,4 @@ class Worker {
}
}
$worker = new Worker($debug, $mysqli, $user, $share);
$worker = new Worker($debug, $mysqli, $user, $share, $config);

View File

@ -15,7 +15,7 @@
</tr>
<tr>
<td class="leftheader">Current Difficulty</td>
<td><a href="http://allchains.info/" target="_new">{$CURRENTDIFFICULTY}</a></td>
<td><a href="http://allchains.info/" target="_new">{$DIFFICULTY}</a></td>
</tr>
</tbody>
</table>

View File

@ -1,6 +1,6 @@
{include file="global/block_header.tpl" ALIGN="left" BLOCK_HEADER="Top Hashrate Contributers"}
<center>
<table width="100%" border="0" style="font-size:13px;" class="sortable">
<table width="100%" border="0" style="font-size:13px;">
<thead>
<tr style="background-color:#B6DAFF;">
<th align="left">Rank</th>
@ -11,16 +11,24 @@
</thead>
<tbody>
{assign var=rank value=1}
{assign var=listed value=0}
{section contrib $CONTRIBHASHES}
<tr class="{cycle values="odd,even"}">
<tr{if $GLOBAL.userdata.username == $CONTRIBHASHES[contrib].account}{assign var=listed value=1} style="background-color:#99EB99;"{else} class="{cycle values="odd,even"}"{/if}>
<td>{$rank++}</td>
<td>{$CONTRIBHASHES[contrib].account}</td>
<td>{$CONTRIBHASHES[contrib].hashrate|number_format}</td>
<td>{math equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24),3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate}</td>
<td>{math equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate}</td>
</tr>
{/section}
{if $listed != 1}
<tr style="background-color:#99EB99;">
<td>n/a</td>
<td>{$GLOBAL.userdata.username}</td>
<td>{$GLOBAL.userdata.hashrate}</td>
<td>{math equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.hashrate}</td>
</tr>
{/if}
</tbody>
</table>
<div id="pagination" class="pagination"></div>
</center>
{include file="global/block_footer.tpl"}

View File

@ -1,6 +1,6 @@
{include file="global/block_header.tpl" ALIGN="right" BLOCK_HEADER="Top Share Contributers"}
<center>
<table width="100%" border="0" style="font-size:13px;" class="sortable">
<table width="100%" border="0" style="font-size:13px;">
<thead>
<tr style="background-color:#B6DAFF;">
<th align="left">Rank</th>
@ -10,15 +10,22 @@
</thead>
<tbody>
{assign var=rank value=1}
{assign var=listed value=0}
{section hashrate $CONTRIBSHARES}
<tr class="{cycle values="odd,even"}">
<tr{if $GLOBAL.userdata.username == $CONTRIBSHARES[hashrate].account}{assign var=listed value=1} style="background-color:#99EB99;"{else} class="{cycle values="odd,even"}"{/if}>
<td>{$rank++}</td>
<td>{$CONTRIBSHARES[hashrate].account}</td>
<td>{$CONTRIBSHARES[hashrate].shares|number_format}</td>
</tr>
{/section}
{if $listed != 1}
<tr style="background-color:#99EB99;">
<td>n/a</td>
<td>{$GLOBAL.userdata.username}</td>
<td>{$GLOBAL.userdata.shares.valid}</td>
</tr>
{/if}
</tbody>
</table>
<div id="pagination" class="pagination"></div>
</center>
{include file="global/block_footer.tpl"}

View File

@ -15,7 +15,7 @@
</tr>
<tr>
<td class="leftheader">Current Difficulty</td>
<td><a href="http://allchains.info/" target="_new">{$CURRENTDIFFICULTY}</a></td>
<td><a href="http://allchains.info/" target="_new">{$DIFFICULTY}</a></td>
</tr>
</tbody>
</table>