Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. //We are asking the database for a list of all the users and give ALL the results
  4. $users = $db->query("SELECT * FROM users")->results();
  5. ?>
  6. <table class="table table-striped">
  7. <thead>
  8. <tr>
  9. <th>Username</th><th>Joined On</th><th>Group(s)</th>
  10. </tr>
  11. </thead>
  12. <tbody>
  13. <?php
  14. //loop through all the users and make one row for each user
  15. foreach($users as $u){ ?>
  16. <tr>
  17. <td><?=$u->username;?></td>
  18. <td><?=$u->join_date?></td>
  19. <td>
  20. <?php
  21. //Look through the permissions for this user
  22. $perms = $db->query("SELECT * FROM user_permission_matches WHERE user_id = ? ",array($u->id))->results();
  23. foreach($perms as $p){
  24. $permission = $db->query("SELECT name from permissions WHERE id = ?",array($p->permission_id))->first();
  25. echo $permission->name .",";
  26. }
  27. ?>
  28.  
  29. </td>
  30. </tr>
  31. <?php } ?>
  32. </tbody>
  33. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement