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.0KB

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