diff --git a/pool/base.php b/pool/base.php
index 01a60961..8903293d 100644
--- a/pool/base.php
+++ b/pool/base.php
@@ -102,14 +102,14 @@ function safetext($txt, $len = 1024)
return $res;
}
#
-function dbd($data)
+function dbd($data, $user)
{
return "
Web site is currently down";
}
#
function dbdown()
{
- gopage(NULL, 'dbd', NULL, '', true, false);
+ gopage(NULL, 'dbd', NULL, '', false, true, false);
}
#
function f404($data)
@@ -119,10 +119,10 @@ function f404($data)
#
function do404()
{
- gopage(NULL, 'f404', NULL, '', true, false);
+ gopage(NULL, 'f404', NULL, '', false, true, false);
}
#
-function showPage($page, $menu, $name)
+function showPage($page, $menu, $name, $user)
{
# If you are doing development, use without '@'
# Then switch to '@' when finished
@@ -131,14 +131,14 @@ function showPage($page, $menu, $name)
$fun = 'show_' . $page;
if (function_exists($fun))
- $fun($menu, $name);
+ $fun($menu, $name, $user);
else
do404();
}
#
function showIndex()
{
- showPage('index', NULL, '');
+ showPage('index', NULL, '', false);
}
#
function offline()
@@ -147,7 +147,7 @@ function offline()
{
$ip = $_SERVER['REMOTE_ADDR'];
if ($ip != '192.168.7.74')
- gopage(NULL, file_get_contents('./maintenance.txt'), NULL, '', false, false);
+ gopage(NULL, file_get_contents('./maintenance.txt'), NULL, '', false, false, false, false);
}
}
#
@@ -260,10 +260,8 @@ function validate()
function loggedIn()
{
list($who, $whoid) = validate();
- if ($who == false)
- return false;
-
- return true;
+ // false if not logged in
+ return $who;
}
#
?>
diff --git a/pool/db.php b/pool/db.php
index d9339206..ae30369d 100644
--- a/pool/db.php
+++ b/pool/db.php
@@ -102,12 +102,11 @@ function checkpass($user, $pass)
return $rep;
}
#
-function getWorkers()
+function getWorkers($user)
{
- list($who, $whoid) = validate();
- if ($who == false)
+ if ($user == false)
showIndex();
- $flds = array('username' => $who);
+ $flds = array('username' => $user);
$msg = msgEncode('workers', 'work', $flds);
$rep = sendsockreply('getworkers', $msg);
if (!$rep)
@@ -115,12 +114,11 @@ function getWorkers()
return $rep;
}
#
-function getPayments()
+function getPayments($user)
{
- list($who, $whoid) = validate();
- if ($who == false)
+ if ($user == false)
showIndex();
- $flds = array('username' => $who);
+ $flds = array('username' => $user);
$msg = msgEncode('payments', 'pay', $flds);
$rep = sendsockreply('getpayments', $msg);
if (!$rep)
diff --git a/pool/page.php b/pool/page.php
index dec1ba05..02258977 100644
--- a/pool/page.php
+++ b/pool/page.php
@@ -333,7 +333,7 @@ function pgfoot()
return $foot;
}
#
-function gopage($data, $page, $menu, $name, $ispage = true, $dotop = true, $douser = true)
+function gopage($data, $page, $menu, $name, $user, $ispage = true, $dotop = true, $douser = true)
{
global $dbg;
global $page_scripts;
@@ -347,7 +347,7 @@ function gopage($data, $page, $menu, $name, $ispage = true, $dotop = true, $dous
$pg = '';
if ($ispage == true)
- $pg .= $page($data);
+ $pg .= $page($data, $user);
else
$pg .= $page;
@@ -355,7 +355,7 @@ function gopage($data, $page, $menu, $name, $ispage = true, $dotop = true, $dous
// unset($_SESSION['logkey']);
$head = pghead($script_marker, $name);
- $body = pgbody($menu, $dotop, $name, $douser);
+ $body = pgbody($menu, $dotop, $user, $douser);
$foot = pgfoot();
if ($dbg === true)
diff --git a/pool/page_help.php b/pool/page_help.php
index 63b2c3d0..85a0c605 100644
--- a/pool/page_help.php
+++ b/pool/page_help.php
@@ -1,13 +1,13 @@
HelplessHelpless';
}
#
-function show_help($menu, $name)
+function show_help($menu, $name, $user)
{
- gopage(NULL, 'dohelp', $menu, $name);
+ gopage(NULL, 'dohelp', $menu, $name, $user);
}
#
?>
diff --git a/pool/page_index.php b/pool/page_index.php
index c6b4aaf9..e39ad7d9 100644
--- a/pool/page_index.php
+++ b/pool/page_index.php
@@ -1,6 +1,6 @@
CKPool
@@ -9,9 +9,9 @@ Welcome to CKPool the bestest mostest gnarliest poolest in the ...... south.
return $pg;
}
#
-function show_index($menu, $name)
+function show_index($menu, $name, $user)
{
- gopage(NULL, 'doindex', $menu, $name);
+ gopage(NULL, 'doindex', $menu, $name, $user);
}
#
?>
diff --git a/pool/page_payments.php b/pool/page_payments.php
index 0b9df450..2fa4c847 100644
--- a/pool/page_payments.php
+++ b/pool/page_payments.php
@@ -1,10 +1,10 @@
Payments';
- $rep = getPayments();
+ $rep = getPayments($user);
$ans = repDecode($rep);
$pg .= "
Name | "; + $pg .= "Difficulty | "; + $pg .= "Idle Notifications | "; + $pg .= "Idle Notification Time | "; + $pg .= "
'.$ans['paydate'.$i].' | '; + $pg .= ''.$ans['payaddress'.$i].' | '; + $pg .= ''.btcfmt($ans['amount'.$i]).' | '; + $pg .= "