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 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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_name => $perm)
  30. {
  31. $role = Role::getRole($db, $role_name);
  32. ?>
  33. <div class="form-group">
  34. <label class="col-sm-3 control-label" for="<?php echo $user->id; ?>_<?php echo $role['role_id']; ?>"><?php echo $role['role_name']; ?></label>
  35. <div class="col-sm-9">
  36. <button type="button" class="btn btn-danger btn-sm remove_user_role" id="<?php echo $user->id; ?>_<?php echo $role['role_id']; ?>">Remove</button>
  37. </div>
  38. </div>
  39. <?php
  40. }
  41. ?>
  42. </div>
  43. <br />
  44. <div class="row">
  45. <div class="col-sm-10">
  46. <select class="form-control selectpicker" name="role_select_<?php echo $user->id; ?>" id="role_select_<?php echo $user->id; ?>">
  47. <?php
  48. $roles = Role::getRoles($db);
  49. foreach ($roles as $role)
  50. {
  51. echo "<option value=\"".$role['role_id']."\">".$role['role_name']."</option>";
  52. }
  53. ?>
  54. </select>
  55. </div>
  56. <div class="col-sm-2">
  57. <button type="button" class="btn btn-default add_user_role" id="<?php echo $user->id; ?>">Add Role</button>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <hr />
  63. <?php
  64. }
  65. }
  66. }
  67. ?>