Simple website with some JavaScript games.
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.

60 lines
1.6 KiB

7 years ago
7 years ago
7 years ago
7 years ago
  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
  16. class="w3-table w3-striped w3-bordered"><thead>';
  17. echo '<tr class="w3-theme">
  18. <td>First Name</td>
  19. <td>Last Name</td>
  20. <td>User Name</td>
  21. <td>Admin</td>
  22. <td><center>Delete User<center></td>
  23. </tr></thead><tbody>';
  24. while($row = mysqli_fetch_array($r))
  25. {
  26. echo '<tr>';
  27. //first name
  28. echo '<td>' . $row['first_name'] . '</td>';
  29. //last name
  30. echo '<td>' . $row['last_name'] . '</td>';
  31. //username
  32. echo '<td>' . $row['user_name'] . '</td>';
  33. //admin
  34. if($row['admin'])
  35. echo '<td>True</td>';
  36. else
  37. echo '<td>False</td>';
  38. echo '<td><form action = "admin.php" method = "post">
  39. <input type = "submit" name="Delete" value="Delete"
  40. class="w3-padding-16 w3-hover-dark-grey w3-btn-block
  41. w3-center-align"/>
  42. <input type="hidden" name="delUser" value="TRUE">
  43. <input type="hidden" name="del_user_id" value=' . $row['user_id']
  44. . '></form></td></td>';
  45. }
  46. echo '</tbody></table></div>';
  47. }