A simple php website which displays quotes on pictures of pandas.
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.

70 lines
2.0 KiB

  1. <?php
  2. //11-24-16
  3. if($admin)
  4. {
  5. if(isset($_POST['delUser']))
  6. {
  7. $i_id = mysqli_real_escape_string($dbc, trim($_POST['del_user_id']));
  8. $q = "delete from users where user_id='$i_id'";
  9. $r = mysqli_query($dbc, $q);
  10. header("Location: admin.php");
  11. }
  12. echo '<h1 class="w3-text-teal"><center>Users</center></h1>';
  13. $q = "select * from users order by first_name asc";
  14. $r = mysqli_query($dbc, $q);
  15. echo '<div class="w3-responsive w3-card-4"><table class="w3-table w3-striped w3-bordered"><thead>';
  16. echo '<tr class="w3-theme">
  17. <td>First Name</td>
  18. <td>Last Name</td>
  19. <td>User Name</td>
  20. <td>Admin</td>
  21. <td><center>Delete User<center></td>
  22. </tr></thead><tbody>';
  23. while($row = mysqli_fetch_array($r))
  24. {
  25. echo '<tr>';
  26. //first name
  27. echo '<td>' . $row['first_name'] . '</td>';
  28. //last name
  29. echo '<td>' . $row['last_name'] . '</td>';
  30. //username
  31. echo '<td>' . $row['user_name'] . '</td>';
  32. //admin
  33. if($row['admin'])
  34. {
  35. echo '<td>True</td>';
  36. }
  37. else
  38. {
  39. echo '<td>False</td>';
  40. }
  41. //del
  42. echo '<td>';
  43. echo '<form action = "admin.php" method = "post">
  44. <input type = "submit" name="Delete" value="Delete" class="w3-padding-16 w3-hover-dark-grey w3-btn-block w3-center-align"/>
  45. <input type="hidden" name="delUser" value="TRUE">
  46. <input type="hidden" name="del_user_id" value=' . $row['user_id'] . '>
  47. </form>';
  48. echo '</td>';
  49. echo '</tr>';
  50. }
  51. echo '</tbody></table></div>';
  52. }
  53. ?>