<?php
    include '../session_restraintes.php';
    $bdd = new PDO('mysql:host=localhost;dbname=ticket;charset:utf8', 'root', '');
    $reponse = $bdd->query("SELECT * FROM logins");
    $arr = [];
    while ($line = $reponse->fetch()) {
        $arr[$line[0]] = $line[1];
    }
    $reponse->closeCursor();
?>

<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>
            <thead>
                <tr>
                    <th colspan="3">Mot de passe</th>
                </tr>
            </thead>
            <tbody>
                <tr class='table-title'>
                    <td>Login</td>
                    <td>Password</td>
                </tr>
                <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="edit" type="button" value="edit" onclick="Edit(\'',$key,'\')"></td>
                        </tr>'; 
                    }
                    ?>
                </tr>
                    
            </tbody>
        </table>
    </body>
</html>