Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

get_user.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. require_once('../includes/config.php');
  3. if(isset($_POST))
  4. {
  5. $query = rawurldecode($_POST['query']);
  6. $user_list = $db->select('users', "username LIKE ?", array('%'.$query.'%'));
  7. $users = array();
  8. foreach ($user_list as $user)
  9. {
  10. if (!is_array($user))
  11. {
  12. $users = array($user_list);
  13. break;
  14. }
  15. array_push($users, $user);
  16. }
  17. if ($users)
  18. {
  19. foreach ($users as $parsed_user)
  20. {
  21. $user = $userTools->getUser($parsed_user['username']);
  22. ?>
  23. <div class="row">
  24. <div class="col-sm-12">
  25. <div class="row"><h3 class="text-center"><strong><?php echo $user->username; ?></strong></h3></div>
  26. <div class="row">
  27. <h4>Roles</h4>
  28. <?php
  29. foreach ($user->roles as $role => $perm)
  30. {
  31. ?>
  32. <div class="form-group">
  33. <label class="sr-only" for="<?php echo $user->id; ?>_<?php echo $role; ?>"><?php echo $role; ?></label>
  34. <button type="button" class="btn btn-danger" id="<?php echo $user->id; ?>_<?php echo $role; ?>">Remove</button>
  35. </div>
  36. <?php
  37. }
  38. ?>
  39. </div>
  40. <div class="row">
  41. <div class="col-sm-10">
  42. <select class="form-control" name="role_select_<?php echo $user->id; ?>" id="role_select_<?php echo $user->id; ?>">
  43. <?php
  44. $roles = Role::getRoles($db);
  45. foreach ($roles as $role)
  46. {
  47. echo "<option>".$role['role_name']."</option>";
  48. }
  49. ?>
  50. </select>
  51. </div>
  52. <div class="col-sm-2">
  53. <button type="button" class="btn btn-default" id="<?php echo $user->id; ?>">Add Role</button>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <?php
  59. }
  60. }
  61. }
  62. ?>