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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. <br />
  41. <div class="row">
  42. <div class="col-sm-10">
  43. <select class="form-control selectpicker" name="role_select_<?php echo $user->id; ?>" id="role_select_<?php echo $user->id; ?>">
  44. <?php
  45. $roles = Role::getRoles($db);
  46. foreach ($roles as $role)
  47. {
  48. echo "<option value=\"".$role['role_id']."\">".$role['role_name']."</option>";
  49. }
  50. ?>
  51. </select>
  52. </div>
  53. <div class="col-sm-2">
  54. <button type="button" class="btn btn-default add_user_role" id="<?php echo $user->id; ?>">Add Role</button>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <hr />
  60. <?php
  61. }
  62. }
  63. }
  64. ?>