userlist.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. $root = $_SERVER['DOCUMENT_ROOT'];
  3. include($root . "/util/session.php"); //checks that the user is logged in
  4. include($root . "/util/privilege_check.php");
  5. checkPrivilege("admin");
  6. $query = "SELECT * FROM users join user_info on users.username=user_info.login";
  7. $result = mysqli_query($db, $query);
  8. if (mysqli_num_rows($result) < 1) {
  9. $error = "No users, how did you get here?";
  10. }
  11. ?>
  12. <!DOCTYPE html>
  13. <html lang="en">
  14. <head>
  15. <title>User List</title>
  16. <link rel="stylesheet" type="text/css" href="adminStyle.css">
  17. <link rel="stylesheet" type="text/css" href="tableStyle.css">
  18. </head>
  19. <?php
  20. include($root . "/admin/header.php");
  21. ?>
  22. <main>
  23. <body>
  24. <li><a href="/admin/admin.php">Back</a></li>
  25. <table border="1px" id="users">
  26. <thead>
  27. <tr>
  28. <th>Username</th>
  29. <th>Usertype</th>
  30. <th>Full Name</th>
  31. <th>SSN</th>
  32. <th>Gender</th>
  33. <th>Phone number</th>
  34. <th>Email</th>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. <?php //ugly php + html hybrid code that does stuff
  39. while ($row = mysqli_fetch_assoc($result)) { ?>
  40. <tr>
  41. <td><?php echo $row['username']; ?>
  42. <a href="/admin/userMod.php?login=<?php echo $row['username'] ?>">Modify</a>
  43. <a href="/admin/userDel.php?username=<?php echo $row['username'] ?>">Delete</a>
  44. </td>
  45. <td><?php echo $row['usertype']; ?></td>
  46. <td><?php echo $row['full_name']; ?></td>
  47. <td><?php echo $row['ssn']; ?></td>
  48. <td><?php echo $row['gender']; ?></td>
  49. <td><?php echo $row['phone']; ?></td>
  50. <td><?php echo $row['email']; ?></td>
  51. <!td>
  52. <?php
  53. // if(!empty($row['picture'])){
  54. // //}echo "<img src = /util/showImage.php?username=" . $row['username'] . " width=200 height=200 >";
  55. // //echo '<img src="data:image/jpeg;base64,'.base64_encode($row['picture']).'width="200" height="200"/>';
  56. // echo '<img width="100" height="100" src="data:image/jpeg;base64,'.base64_encode($row['picture']).'"/>';
  57. // }
  58. ?>
  59. <! /td>
  60. </tr>
  61. <?php } ?>
  62. </tbody>
  63. </table>
  64. </body>
  65. </html>
  66. </main>
  67. <?php
  68. include($root . "/admin/footer.php");
  69. ?>