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.
 
 

33 lines
1001 B

<h1>User Management</h1>
<?php
require_once 'db.php';
$q = $pdo->prepare('SELECT * FROM users ORDER BY login');
$q->execute();
$users = $q->fetchAll();
echo "<table class='table table-hover table-bordered'>";
echo "<thead>";
echo "<tr>";
echo "<th>Login</th>";
echo "<th>Nickname</th>";
echo "<th>Active</th>";
echo "<th>Timestamp</th>";
echo "<th>IP Address</th>";
echo "<th>Actions</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
foreach ($users as $user) {
echo "<tr>";
echo "<td>" . htmlspecialchars($user['login']) . "</td>";
echo "<td>" . htmlspecialchars($user['nickname']) . "</td>";
echo "<td>" . ($user['active'] ? 'Yes' : 'No') . "</td>";
echo "<td>" . date('Y-m-d H:i:s', $user['timestamp']) . "</td>";
echo "<td>" . htmlspecialchars($user['ip_addr']) . "</td>";
echo "<td><a href='edit_user.php?id=" . $user['id'] . "'>Edit</a> | <a href='delete_user.php?id=" . $user['id'] . "'>Delete</a></td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";