<?php
require_once "labClass.php";
$con = new labClass();
$c=0;
$user=$_POST['user'];
$users = $con->getAllUsers();
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Registered Users</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-4">

<div class="container mt-4">
  <div class="card shadow border-0 rounded-4">
    <div class="card-body">
      <h4 class="text-center mb-3">Registered login secret</h4>
      <table class="table table-striped table-bordered text-center align-middle">
        <thead class="table-dark">
          <tr>
            <th>ID</th>
            <th>Description/ Username</th>
            <th>Password</th>
            <th>Created At</th>
            
          </tr>
        </thead>
        <tbody>
          <?php if ($users): ?>
            <?php foreach ($users as $u):
            $c++;
            ?>
          
            <tr>
            <td width="5%">
             <input name="id<?=$c?>" disabled="true" id="id<?=$c?>" type="text"  
            value="<?= htmlspecialchars($u['id']) ?>" 
            style="width:100%; background:transparent; border:none; outline:none; color:inherit;display:none;" />
            <?= htmlspecialchars($u['id']) ?>
           </td>
                
                <td><?= htmlspecialchars($u['username']) ?></td>
                <td><?= htmlspecialchars($u['password']) ?></td>
                <td><?= htmlspecialchars($u['created_at']) ?></td>
                 
              </tr>
            <?php endforeach; ?>
          <?php else: ?>
            <tr><td colspan="4">No users found</td></tr>
          <?php endif; ?>
        </tbody>
      </table>
       
    </div>
  </div>
</div>

</body>
</html>
