diff --git a/pool/db.php b/pool/db.php index 17178c4e..044c040c 100644 --- a/pool/db.php +++ b/pool/db.php @@ -46,11 +46,11 @@ function repDecode($rep) return $ans; } # -function msgEncode($id, $cmd, $fields) +function msgEncode($cmd, $id, $fields) { global $send_sep, $fld_sep, $val_sep; - $msg = $id . $send_sep . $cmd; + $msg = $cmd . $send_sep . $id; $first = true; foreach ($fields as $name => $value) { @@ -105,23 +105,37 @@ function checkpass($user, $pass) { $passhash = myhash($pass); $flds = array('username' => $user, 'passwordhash' => $passhash); - $msg = msgEncode('log', 'chkpass', $flds); + $msg = msgEncode('chkpass', 'log', $flds); $rep = sendsockreply('checkpass', $msg); if (!$rep) dbdown(); return $rep; } # -function getpayments() +function getWorkers() { list($who, $whoid) = validate(); if ($who == false) showIndex(); $flds = array('username' => $who); - $msg = msgEncode('pay', 'payments', $flds); + $msg = msgEncode('workers', 'work', $flds); + $rep = sendsockreply('getworkers', $msg); + if (!$rep) + dbdown(); + return $rep; +} +# +function getPayments() +{ + list($who, $whoid) = validate(); + if ($who == false) + showIndex(); + $flds = array('username' => $who); + $msg = msgEncode('payments', 'pay', $flds); $rep = sendsockreply('getpayments', $msg); if (!$rep) dbdown(); return $rep; } +# ?> diff --git a/pool/page_reg.php b/pool/page_reg.php index cb9c5a51..81dbf196 100644 --- a/pool/page_reg.php +++ b/pool/page_reg.php @@ -110,13 +110,13 @@ function show_reg($menu, $name) $flds = array('username' => $user, 'emailaddress' => $mail, 'passwordhash' => $passhash); - $msg = msgEncode('reg', 'adduser', $flds); + $msg = msgEncode('adduser', 'reg', $flds); $rep = sendsockreply('show_reg', $msg); if (!$rep) dbdown(); $ans = repDecode($rep); - if ($ans['STATUS'] == 'added') + if ($ans['STATUS'] == 'ok') gopage($data, 'doreg2', $menu, $name, true, true, false); else $data['error'] = "Invalid details";