Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. <?php include "header.php"; ?>
  2.  
  3. <?php
  4.  
  5. $EID = $_SESSION['id'];
  6. $userStatus = "1";
  7. /**
  8. * List all users with a link to edit
  9. */
  10.  
  11. try {
  12. require "../config.php";
  13. require "../common.php";
  14.  
  15. $connection = new PDO($dsn, $username, $password, $options);
  16.  
  17.  
  18.  
  19. $sql = "SELECT user.id, user.status, user.firstname, user.lastname, user.emailaddress, user.username, usertype.type FROM user LEFT JOIN usertype ON user.usertype=usertype.id WHERE user.status=$userStatus ORDER BY user.id";
  20.  
  21.  
  22.  
  23.  
  24. $statement = $connection->prepare($sql);
  25. $statement->execute();
  26.  
  27. $result = $statement->fetchAll();
  28.  
  29. } catch(PDOException $error) {
  30. echo $sql . "<br>" . $error->getMessage();
  31. }
  32. ?>
  33. <!-- $sql = "SELECT * FROM user"; -->
  34. <style type="text/css">
  35. .container{padding: 10px; font: 14px sans-serif; }
  36. .col1{padding:20px;}
  37. .col-md-3{ width: 350px; padding: 20px; font: 14px sans-serif; }
  38. .table{ padding: 20px; }
  39. </style>
  40.  
  41.  
  42.  
  43.  
  44.  
  45. <div class="container">
  46. <div class="row">
  47. <div class="col1"><h2>View Active Users</h2><br> Users marked active can sign in and enter time information into TimeClock.<br> </div>
  48. <div class="col2"> </div>
  49. </div>
  50. <div class="row">
  51. <div class="col text-left">
  52. <a href="register.php" class="btn btn-primary mr-1" role="button"><i class="fa fa-plus">&nbsp;</i>Add New User</a>
  53. <a href="usersInactive.php" class="btn btn-warning mr-1" role="button">Inactive Users</a>
  54. </div>
  55. </div>
  56. </div>
  57.  
  58.  
  59. <table class="table table-bordered table-striped">
  60. <thead>
  61. <tr>
  62. <th>ID</th>
  63. <th>Status</th>
  64. <th>First Name</th>
  65. <th>Last Name</th>
  66. <th>E-Mail Address</th>
  67. <th>Username</th>
  68. <th>Type</th>
  69. <th>Edit</th>
  70. <th>User Status</th>
  71. </tr>
  72. </thead>
  73. <tbody>
  74. <?php foreach ($result as $row) : ?>
  75. <tr>
  76. <td><?php echo escape($row["id"]); ?></td>
  77. <td><?php echo escape($row["status"]);?></td>
  78. <td><?php echo escape($row["firstname"]); ?></td>
  79. <td><?php echo escape($row["lastname"]); ?></td>
  80. <td><?php echo escape($row["emailaddress"]); ?></td>
  81. <td><?php echo escape($row["username"]); ?></td>
  82. <td><?php echo escape($row["usertype"]); ?></td>
  83. <td><a href="user-password-reset.php?id=<?php echo escape($row["id"]); ?>">Password Reset</a> |
  84. <a href="usersEdit.php?id=<?php echo escape($row["id"]); ?>">Edit</a>
  85. <td align="center">
  86.  
  87. <button type="submit" class="btn btn-danger changestatus2" value="<?php echo $row['id']; ?>" id="deactivate" name="deactivate">Deactivate</button>
  88. </td>
  89.  
  90.  
  91. <script>
  92. $(".changestatus2").click(function () {
  93. var user_id = $(this).val();
  94. $.ajax({
  95. type:"POST",
  96. url:"changestatus2.php",
  97. data:{ id: user_id,},
  98. success:function () {
  99. window.location.reload(true);
  100. }
  101.  
  102. });
  103. });
  104. </script>
  105.  
  106.  
  107.  
  108.  
  109. </tr>
  110. <?php endforeach; ?>
  111. </tbody>
  112. </table>
  113. </div>
  114.  
  115.  
  116.  
  117.  
  118. <?php include "footer.php"; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement