diff --git a/pool/base.php b/pool/base.php index 8bfa50ab..ba3ed601 100644 --- a/pool/base.php +++ b/pool/base.php @@ -192,10 +192,11 @@ include_once('db.php'); # function validUserPass($user, $pass) { - $rep = checkpass($user, $pass); - $ans = repDecode($rep); + $rep = checkPass($user, $pass); + if ($rep != null) + $ans = repDecode($rep); usleep(100000); // Max 10x per second - if ($ans['STATUS'] == 'ok') + if ($rep != null && $ans['STATUS'] == 'ok') { $key = 'ckp'.rand(1000000,9999999); $_SESSION['ckpkey'] = $key; diff --git a/pool/db.php b/pool/db.php index 09f3897f..39df49d7 100644 --- a/pool/db.php +++ b/pool/db.php @@ -116,7 +116,7 @@ function homeInfo($user) return $ans; } # -function checkpass($user, $pass) +function checkPass($user, $pass) { $passhash = myhash($pass); $flds = array('username' => $user, 'passwordhash' => $passhash); @@ -124,7 +124,18 @@ function checkpass($user, $pass) $rep = sendsockreply('checkpass', $msg); if (!$rep) dbdown(); - return $rep; + return repDecode($rep); +} +# +function userReg($user, $email, $pass) +{ + $passhash = myhash($pass); + $flds = array('username' => $user, 'emailaddress' => $email, 'passwordhash' => $passhash); + $msg = msgEncode('adduser', 'reg', $flds); + $rep = sendsockreply('adduser', $msg); + if (!$rep) + dbdown(); + return repDecode($rep); } # function getAllUsers() @@ -134,7 +145,7 @@ function getAllUsers() $rep = sendsockreply('getAllUsers', $msg); if (!$rep) dbdown(); - return $rep; + return repDecode($rep); } # function getWorkers($user) @@ -146,7 +157,7 @@ function getWorkers($user) $rep = sendsockreply('getWorkers', $msg); if (!$rep) dbdown(); - return $rep; + return repDecode($rep); } # function getPayments($user) @@ -158,7 +169,7 @@ function getPayments($user) $rep = sendsockreply('getPayments', $msg); if (!$rep) dbdown(); - return $rep; + return repDecode($rep); } # function getBlocks($user) @@ -170,7 +181,7 @@ function getBlocks($user) $rep = sendsockreply('getBlocks', $msg); if (!$rep) dbdown(); - return $rep; + return repDecode($rep); } # ?> diff --git a/pool/page_blocks.php b/pool/page_blocks.php index 0168b8d2..75f98349 100644 --- a/pool/page_blocks.php +++ b/pool/page_blocks.php @@ -4,8 +4,7 @@ function doblocks($data, $user) { $pg = '