';
$pg .= 'Register';
- if (isset($data['error']))
- $pg .= " ".$data['error']." - please try again
";
+ if (isset($data['data']['error']))
+ $pg .= " ".$data['data']['error']." - please try again
";
$pg .= makeForm('');
$pg .= "
@@ -65,8 +65,8 @@ An Email will be sent to you, to let you reset your password
#
function doreg2($data)
{
- if (isset($data['user']))
- $user = htmlspecialchars($data['user']);
+ if (isset($data['data']['user']))
+ $user = htmlspecialchars($data['data']['user']);
else
$user = '';
@@ -74,8 +74,8 @@ function doreg2($data)
// $pg .= ' You will receive an email shortly to verify your account';
$pg .= ' Your account is registered and ready to mine.';
$pg .= ' Choose your own worker names in cgminer.';
- $pg .= ' Worker names must start with your username like';
- $pg .= ": ${user}_ or ${user}.";
+ $pg .= ' Worker names must start with your username and a dot or an underscore';
+ $pg .= " e.g. ${user}_worker1 or ${user}.worker7";
return $pg;
}
#
@@ -138,8 +138,8 @@ function try_reg($page, $menu, $name, $u)
#
function doreset2($data)
{
- $user = $data['user'];
- $email = $data['email'];
+ $user = $data['data']['user'];
+ $email = $data['data']['email'];
$emailinfo = getOpts($user, emailOptList());
if ($emailinfo['STATUS'] != 'ok')
@@ -154,7 +154,7 @@ function doreset2($data)
{
// This line $code = isn't an attempt at security -
// it's simply to ensure the username is readable when we get it back
- $code = bin2hex($data['user']). '_';
+ $code = bin2hex($data['data']['user']). '_';
// A code that's large enough to not be worth guessing
$ran = $ans['STAMP'].$user.$email.rand(100000000,999999999);
diff --git a/pool/page_stats.php b/pool/page_stats.php
index 7b27d35c..ede9f6d5 100644
--- a/pool/page_stats.php
+++ b/pool/page_stats.php
@@ -12,6 +12,50 @@ function dostats($data, $user)
{
$pg = 'Pool Stats';
+ if (isset($data['info']) && $data['info'] !== false)
+ {
+ $info = $data['info'];
+ $dsp = '?THs';
+ $dsp5m = '?THs';
+ $dsp1hr = '?THs';
+ $dsp24hr = '?THs';
+
+ if (isset($info['p_hashrate']))
+ {
+ $hr = $info['p_hashrate'];
+ if ($hr != '?')
+ $dsp = dsprate($hr);
+ }
+
+ if (isset($info['p_hashrate5m']))
+ {
+ $hr = $info['p_hashrate5m'];
+ if ($hr != '?')
+ $dsp5m = dsprate($hr);
+ }
+
+ if (isset($info['p_hashrate1hr']))
+ {
+ $hr = $info['p_hashrate1hr'];
+ if ($hr != '?')
+ $dsp1hr = dsprate($hr);
+ }
+
+ if (isset($info['p_hashrate24hr']))
+ {
+ $hr = $info['p_hashrate24hr'];
+ if ($hr != '?')
+ $dsp24hr = dsprate($hr);
+ }
+
+ $pg .= '';
+ $pg .= "Pool Hashrate: $dsp | ";
+ $pg .= "5m: $dsp5m | ";
+ $pg .= "1hr: $dsp1hr | ";
+ $pg .= "24hr: $dsp24hr | ";
+ $pg .= '
';
+ }
+
$ans = getAllUsers($user);
$pg .= "\n";
@@ -45,17 +89,7 @@ function dostats($data, $user)
if ($uhr == '?')
$dsp = '?GHs';
else
- {
- $uhr /= 10000000;
- if ($uhr < 100000)
- $rate = 'G';
- else
- {
- $rate = 'T';
- $uhr /= 1000;
- }
- $dsp = number_format($uhr/100, 2).$rate.'Hs';
- }
+ $dsp = dsprate($uhr);
$pg .= "$dsp | ";
$pg .= "\n";
}
diff --git a/pool/page_workers.php b/pool/page_workers.php
index fe007999..3157703d 100644
--- a/pool/page_workers.php
+++ b/pool/page_workers.php
@@ -82,16 +82,7 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
else
{
$totrate += $uhr;
- $uhr /= 10000000;
- if ($uhr < 0.01)
- $uhr = '0GHs';
- else
- {
- if ($uhr < 100000)
- $uhr = number_format(round($uhr)/100,2).'GHs';
- else
- $uhr = number_format(round($uhr/1000)/100,2).'THs';
- }
+ $uhr = dsprate($uhr);
}
$pg .= "$uhr | ";
@@ -106,16 +97,7 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
function worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate, $blockacc, $blockreward)
{
$pg = '';
- $totrate /= 10000000;
- if ($totrate < 0.01)
- $totrate = '0GHs';
- else
- {
- if ($totrate < 100000)
- $totrate = number_format(round($totrate)/100,2).'GHs';
- else
- $totrate = number_format(round($totrate/1000)/100,2).'THs';
- }
+ $totrate = dsprate($totrate);
if (($offset % 2) == 0)
$row = 'even';
else
diff --git a/src/ckdb.h b/src/ckdb.h
index f27fafdc..97706cdc 100644
--- a/src/ckdb.h
+++ b/src/ckdb.h
@@ -52,7 +52,7 @@
#define DB_VLOCK "1"
#define DB_VERSION "0.9.2"
-#define CKDB_VERSION DB_VERSION"-0.402"
+#define CKDB_VERSION DB_VERSION"-0.403"
#define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__
diff --git a/src/ckdb_cmd.c b/src/ckdb_cmd.c
index bc1ab02b..5d146727 100644
--- a/src/ckdb_cmd.c
+++ b/src/ckdb_cmd.c
@@ -2006,6 +2006,10 @@ static char *cmd_homepage(__maybe_unused PGconn *conn, char *cmd, char *id,
snprintf(tmp, sizeof(tmp), "workers=%s%c", reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
+ double_to_buf(poolstats->hashrate, reply, siz);
+ snprintf(tmp, sizeof(tmp), "p_hashrate=%s%c", reply, FLDSEP);
+ APPEND_REALLOC(buf, off, len, tmp);
+
double_to_buf(poolstats->hashrate5m, reply, siz);
snprintf(tmp, sizeof(tmp), "p_hashrate5m=%s%c", reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
@@ -2014,13 +2018,24 @@ static char *cmd_homepage(__maybe_unused PGconn *conn, char *cmd, char *id,
snprintf(tmp, sizeof(tmp), "p_hashrate1hr=%s%c", reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
+ double_to_buf(poolstats->hashrate24hr, reply, siz);
+ snprintf(tmp, sizeof(tmp), "p_hashrate24hr=%s%c", reply, FLDSEP);
+ APPEND_REALLOC(buf, off, len, tmp);
+
bigint_to_buf(poolstats->elapsed, reply, siz);
snprintf(tmp, sizeof(tmp), "p_elapsed=%s%c", reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
+
+ tvs_to_buf(&(poolstats->createdate), reply, siz);
+ snprintf(tmp, sizeof(tmp), "p_statsdate=%s%c", reply, FLDSEP);
+ APPEND_REALLOC(buf, off, len, tmp);
} else {
- snprintf(tmp, sizeof(tmp), "users=?%cworkers=?%cp_hashrate5m=?%c"
- "p_hashrate1hr=?%cp_elapsed=?%c",
- FLDSEP, FLDSEP, FLDSEP, FLDSEP, FLDSEP);
+ snprintf(tmp, sizeof(tmp), "users=?%cworkers=?%cp_hashrate=?%c"
+ "p_hashrate5m=?%cp_hashrate1hr=?%c"
+ "p_hashrate24hr=?%cp_elapsed=?%c"
+ "p_statsdate=?%c",
+ FLDSEP, FLDSEP, FLDSEP, FLDSEP,
+ FLDSEP, FLDSEP, FLDSEP, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp);
}
diff --git a/src/ckdb_dbio.c b/src/ckdb_dbio.c
index b4ad1773..a7f4a2e2 100644
--- a/src/ckdb_dbio.c
+++ b/src/ckdb_dbio.c
@@ -4456,6 +4456,7 @@ unparam:
return ok;
}
+// This is to RAM. The summariser calls the DB I/O functions for userstats
bool userstats_add(char *poolinstance, char *elapsed, char *username,
char *workername, char *hashrate, char *hashrate5m,
char *hashrate1hr, char *hashrate24hr, bool idle,
|