Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include "header.php"; ?>
- <?php
- $EID = $_SESSION['id'];
- $userStatus = "1";
- /**
- * List all users with a link to edit
- */
- try {
- require "../config.php";
- require "../common.php";
- $connection = new PDO($dsn, $username, $password, $options);
- $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";
- $statement = $connection->prepare($sql);
- $statement->execute();
- $result = $statement->fetchAll();
- } catch(PDOException $error) {
- echo $sql . "<br>" . $error->getMessage();
- }
- ?>
- <!-- $sql = "SELECT * FROM user"; -->
- <style type="text/css">
- .container{padding: 10px; font: 14px sans-serif; }
- .col1{padding:20px;}
- .col-md-3{ width: 350px; padding: 20px; font: 14px sans-serif; }
- .table{ padding: 20px; }
- </style>
- <div class="container">
- <div class="row">
- <div class="col1"><h2>View Active Users</h2><br> Users marked active can sign in and enter time information into TimeClock.<br> </div>
- <div class="col2"> </div>
- </div>
- <div class="row">
- <div class="col text-left">
- <a href="register.php" class="btn btn-primary mr-1" role="button"><i class="fa fa-plus"> </i>Add New User</a>
- <a href="usersInactive.php" class="btn btn-warning mr-1" role="button">Inactive Users</a>
- </div>
- </div>
- </div>
- <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th>ID</th>
- <th>Status</th>
- <th>First Name</th>
- <th>Last Name</th>
- <th>E-Mail Address</th>
- <th>Username</th>
- <th>Type</th>
- <th>Edit</th>
- <th>User Status</th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($result as $row) : ?>
- <tr>
- <td><?php echo escape($row["id"]); ?></td>
- <td><?php echo escape($row["status"]);?></td>
- <td><?php echo escape($row["firstname"]); ?></td>
- <td><?php echo escape($row["lastname"]); ?></td>
- <td><?php echo escape($row["emailaddress"]); ?></td>
- <td><?php echo escape($row["username"]); ?></td>
- <td><?php echo escape($row["usertype"]); ?></td>
- <td><a href="user-password-reset.php?id=<?php echo escape($row["id"]); ?>">Password Reset</a> |
- <a href="usersEdit.php?id=<?php echo escape($row["id"]); ?>">Edit</a>
- <td align="center">
- <button type="submit" class="btn btn-danger changestatus2" value="<?php echo $row['id']; ?>" id="deactivate" name="deactivate">Deactivate</button>
- </td>
- <script>
- $(".changestatus2").click(function () {
- var user_id = $(this).val();
- $.ajax({
- type:"POST",
- url:"changestatus2.php",
- data:{ id: user_id,},
- success:function () {
- window.location.reload(true);
- }
- });
- });
- </script>
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>
- </div>
- <?php include "footer.php"; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement