userlist.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. <body>
  20. <?php
  21. include($root . "/admin/header.php");
  22. ?>
  23. <li><a href="/admin/admin.php">Back</a></li>
  24. <table border="1px" id="users">
  25. <thead>
  26. <tr>
  27. <th>Username</th>
  28. <th>Usertype</th>
  29. <th>Full Name</th>
  30. <th>SSN</th>
  31. <th>Gender</th>
  32. <th>Phone number</th>
  33. <th>Email</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. <?php //ugly php + html hybrid code that does stuff
  38. while($row=mysqli_fetch_assoc($result)){?>
  39. <tr>
  40. <td><?php echo $row['username']; ?>
  41. <a href="/admin/userMod.php?login=<?php echo $row['username']?>">Modify</a>
  42. <a href="/admin/userDel.php?username=<?php echo $row['username']?>">Delete</a>
  43. </td>
  44. <td><?php echo $row['usertype']; ?></td>
  45. <td><?php echo $row['full_name']; ?></td>
  46. <td><?php echo $row['ssn']; ?></td>
  47. <td><?php echo $row['gender']; ?></td>
  48. <td><?php echo $row['phone']; ?></td>
  49. <td><?php echo $row['email'];?></td>
  50. <!td>
  51. <?php
  52. // if(!empty($row['picture'])){
  53. // //}echo "<img src = /util/showImage.php?username=" . $row['username'] . " width=200 height=200 >";
  54. // //echo '<img src="data:image/jpeg;base64,'.base64_encode($row['picture']).'width="200" height="200"/>';
  55. // echo '<img width="100" height="100" src="data:image/jpeg;base64,'.base64_encode($row['picture']).'"/>';
  56. // }
  57. ?>
  58. <!/td>
  59. </tr>
  60. <?php }?>
  61. </tbody>
  62. </table>
  63. <?php
  64. include($root . "/admin/footer.php");
  65. ?>
  66. </body>
  67. </html>