<?php
    include '../sessions/session_restraintes.php';
    $bdd = new SQLite3('../database/ticket_panne.db', SQLITE3_OPEN_READWRITE);
    $reponse = $bdd->query("SELECT * FROM logins");
    $arr = [];
    while ($line = $reponse->fetchArray()) {
        $arr[$line[0]] = $line[1];
    }
?>

<html>
    <head>
        <?php include 'include/menu.html'; ?>
        <script type="text/javascript" src="js/admin.js" defer></script>
    </head>
    <body>
        <?php include 'include/nav.php'; ?>
        <table class="table">
            <thead>
                <tr>
                    <th colspan="3">Mot de passe</th>
                </tr>
            </thead>
            <tbody>
                <tr class='table__title'>
                    <td>Identifiant</td>
                    <td>Mot de passe</td>
                </tr>
                <?php
                foreach ($arr as $key => $value) {
                    echo '<tr>
                        <td class=',$key,' style="font-weight: bold;">', $key,'</td>
                        <td class=',$key,'>', $value,'</td>
                        <td class=',$key,'><input class="button button--small" type="button" value="edit" onclick="Edit(\'',$key,'\')"></td>
                    </tr>';
                }
                ?>
            </tbody>
        </table>
    </body>
</html>