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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. <select class="form-control" name="role_select">
  42. <?php
  43. $roles = Role::getRoles();
  44. foreach ($roles as $role)
  45. {
  46. echo "<option>".$role['role_name']."</option>";
  47. }
  48. ?>
  49. </select>
  50. <button class="btn btn-default pull-right" id="<?php echo $user->id; ?>">Add Role</button>
  51. </div>
  52. </div>
  53. </div>
  54. <?php
  55. }
  56. }
  57. }
  58. ?>