<?php
include_once("conexao.php");
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    <style>
        .moss-green {
            background-color: #4A5D23;
            color: white;
        }
    </style>
    <title>Moss Green Table</title>
</head>
<body>
    <div class="container">
        <table class="table moss-green">
            <thead>
                <tr>
                    <th scope="col">Column 1</th>
                    <th scope="col">Column 2</th>
                    <th scope="col">Column 3</th>
                    <th scope="col">Column 4</th>
                </tr>
            </thead>
            <tbody>
<?php    
$result_usuario = "SELECT * FROM acessos ORDER BY data DESC";
$resultado_usuario = mysqli_query($conn, $result_usuario);
if(($resultado_usuario) AND ($resultado_usuario->num_rows != 0)){
while($row_usuario = mysqli_fetch_assoc($resultado_usuario)){    
    echo"<tr>";
     echo"<td>".$row_usuario['login']."</td>";
      echo"<td style='text-transform: uppercase'>".$row_usuario['nome']."</td>";
 //     echo"<td>".$row_usuario['data']."</td>";
        $data = $row_usuario['data'];
        $data = strtotime($data);
        echo"<td>".date('d/m/Y H:i:s', $data)."</td>";
      echo"</tr>";
}
}else{
    echo"<tr>";
	echo "<td><div class='alert alert-danger' role='alert'>Nenhum registro encontrado!</div></td>";
		echo "<td><div class='alert alert-danger' role='alert'>Nenhum registro encontrado!</div></td>";
			echo "<td><div class='alert alert-danger' role='alert'>Nenhum registro encontrado!</div></td>";

	echo"</tr>";
}
?>    
 </tbody>
        </table>
    </div>
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</body>
</html>