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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. <div class="col-sm-6">
  28. <ul class="list-group">
  29. <li class="list-group-item text-right"><span class="pull-left"><strong>Joined</strong></span> <?php echo $user->join_date; ?></li>
  30. <li class="list-group-item text-right"><span class="pull-left"><strong>Last Seen</strong></span> <?php echo $user->last_seen; ?></li>
  31. <li class="list-group-item text-right"><span class="pull-left"><strong>Email</strong></span> <a href="mailto:<?php echo $user->username; ?>@teknik.io"><?php echo $user->username; ?>@teknik.io</a></li>
  32. <li class="list-group-item text-right"><span class="pull-left"><strong>Blog</strong></span> <a href="<?php echo get_page_url('blog', $CONF).'/'.$user->username; ?>" id="blog_title"><?php echo $user->blog_title; ?></a></li>
  33. <li class="list-group-item text-center"><button type="button" class="btn btn-danger delete_account" id="<?php echo $user->id; ?>">Delete Account</button></li>
  34. </ul>
  35. </div>
  36. <div class="col-sm-6">
  37. <div class="row">
  38. <h4>Roles</h4>
  39. <?php
  40. foreach ($user->roles as $role_name => $perm)
  41. {
  42. $role = Role::getRole($db, $role_name);
  43. ?>
  44. <div class="form-group">
  45. <label class="col-sm-8 control-label" for="<?php echo $user->id; ?>_<?php echo $role['role_id']; ?>"><?php echo $role['role_name']; ?></label>
  46. <div class="col-sm-4">
  47. <button type="button" class="btn btn-danger btn-sm remove_user_role" id="<?php echo $user->id; ?>_<?php echo $role['role_id']; ?>">Remove</button>
  48. </div>
  49. </div>
  50. <?php
  51. }
  52. ?>
  53. </div>
  54. <br />
  55. <div class="row">
  56. <div class="col-sm-10">
  57. <select class="selectpicker" name="role_select_<?php echo $user->id; ?>" id="role_select_<?php echo $user->id; ?>">
  58. <?php
  59. $roles = Role::getRoles($db);
  60. foreach ($roles as $role)
  61. {
  62. echo "<option value=\"".$role['role_id']."\">".$role['role_name']."</option>";
  63. }
  64. ?>
  65. </select>
  66. </div>
  67. <div class="col-sm-2">
  68. <button type="button" class="btn btn-default add_user_role" id="<?php echo $user->id; ?>">Add Role</button>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <hr />
  76. <?php
  77. }
  78. }
  79. }
  80. ?>