X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=people.php;h=31b4fa07f96a97d6bbea4ea0fba393b1f2359e1f;hb=f78460b6d888bb82adebd32931d707792bc77710;hp=1690a4b487b90819097d64134faa1ad39c2c3419;hpb=1bcde3c6ba88a93deaa0848df4de0b0857d9bf49;p=contractor-progress.git diff --git a/people.php b/people.php index 1690a4b..31b4fa0 100644 --- a/people.php +++ b/people.php @@ -1,21 +1,20 @@ . + define('PEOPLE_DB_FIELDS', 'username,password,name,privs,balance'); @@ -47,8 +46,8 @@ function people_tem_sets($username, $password, $name, $privs, $balance) { } # You may pass a "where clause" for the db query. -function people_display_listing($where = 'order by username limit 100') { - $rows = db_get_rows('people', 'id,username', $where); +function people_display_listing($where = 'order by name limit 100') { + $rows = db_get_rows('people', 'id,name,username', $where); if($rows == false || count($rows) == 0) { tem_show('empty_listing'); tem_show('listings'); @@ -56,11 +55,12 @@ function people_display_listing($where = 'order by username limit 100') { } foreach($rows as $row) { - list($id, $username) = $row; + list($id, $name, $username) = $row; tem_set('id', $id); if($username == '') { $username = '--'; } + tem_set('name', $name); tem_set('username', $username); tem_show('listing_row'); } @@ -70,7 +70,7 @@ function people_display_listing($where = 'order by username limit 100') { } function people_main() { - if(logged_in() != 1) { # FIXME get more sophisticated than first person in database is admin + if(!logged_in_as_contractor()) { $GLOBALS['url'] = this_url(); message('You must be logged in as an administrator to access that function'); return 'login'; @@ -124,7 +124,7 @@ function _people_main() { db_update('people', PEOPLE_DB_FIELDS, $username, $password_hash, $name, $privs, $balance, 'where id=%i', $edit_id); message('Entry updated.'); } else { - db_insert('people', PEOPLE_DB_FIELDS, $username, $password_hash, $name, $privs, $balance); + db_insert('people', PEOPLE_DB_FIELDS . ',tiny_agreement', $username, $password_hash, $name, $privs, $balance, 1000); message('Entry saved.'); } if($error !== true) {