<?php //include 'layout/header.php'; ?> <div class="container mt-4"> <div class="d-flex justify-content-between align-items-center mb-4"> <h2>Users List</h2> <a href="usersorm/create" class="btn btn-primary">Create New User</a> </div> <?php if (isset($_SESSION['success'])): ?> <div class="alert alert-success"> <?= $_SESSION['success']; ?> <?php unset($_SESSION['success']); ?> </div> <?php endif; ?> <?php if (isset($_SESSION['error'])): ?> <div class="alert alert-danger"> <?= $_SESSION['error']; ?> <?php unset($_SESSION['error']); ?> </div> <?php endif; ?> <table class="table table-striped"> <thead> <tr> <th>ID</th> <th>Name</th> <th>Email</th> <th>Created At</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($users as $user): ?> <tr> <td><?= htmlspecialchars($user['id']) ?></td> <td><?= htmlspecialchars($user['name']) ?></td> <td><?= htmlspecialchars($user['email']) ?></td> <td><?= htmlspecialchars($user['stamp']) ?></td> <td> <a href="usersorm/edit/<?= $user['id'] ?>" class="btn btn-sm btn-info">Edit</a> <form action="usersorm/delete/<?= $user['id'] ?>" method="POST" class="d-inline"> <button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure?')">Delete</button> </form> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php if ($pagination['total'] > 1): ?> <nav> <ul class="pagination"> <?php for ($i = 1; $i <= $pagination['total']; $i++): ?> <li class="page-item <?= $i === $pagination['current'] ? 'active' : '' ?>"> <a class="page-link" href="?page=<?= $i ?>"><?= $i ?></a> </li> <?php endfor; ?> </ul> </nav> <?php endif; ?> </div> <?php //include 'layout/footer.php'; ?>
info at phpclasses dot org