<?php
$page_title = "مدیریت کاربران";
require 'config/db.php';
require 'includes/header.php';
require 'includes/sidebar.php';
require 'check_admin.php';
$stmt = $pdo->query("SELECT * FROM users ORDER BY id DESC");
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<h1>لیست کاربران</h1>

<table>
    <tr>
        <th>ID</th>
        <th>نام کامل</th>
        <th>ایمیل</th>
        <th>تلفن</th>
        <th>نقش</th>
    </tr>
    <?php foreach ($users as $u): ?>
        <tr>
            <td><?php echo $u['id']; ?></td>
            <td><?php echo htmlspecialchars($u['full_name']); ?></td>
            <td><?php echo htmlspecialchars($u['email']); ?></td>
            <td><?php echo htmlspecialchars($u['phone']); ?></td>
            <td><?php echo $u['role']; ?></td>
        </tr>
    <?php endforeach; ?>
</table>

<?php
require 'includes/footer.php';