<?php 
include ('includes/header.php');
$db = new SQLite3("a/.logs.db");
$res = $db->query("SELECT * FROM logs ORDER by id DESC");

if(isset($_GET['delete'])) {
    $id = $_GET['delete'];
    $db->exec("DELETE FROM logs WHERE id = '$id'");
}
?>
	<div class="card border-left-primary card mb-4">
	<center>
		<h1 class="colorboard"></i> LOGS</h1>
	
	</center>
	<br>
	<div class="table-responsive" style="padding: 10px;">
		<table class="table table-striped table-sm" >
			<thead style="color:white!important">
				<tr>
					<th>ID</th>
					<th>Data</th>
					<th>IP Address</th>
				    <th>Deletar</th>
				</tr>
			</thead>
			<?php while ($row = $res->fetchArray()) {?>
			<tbody>
				<tr>
					<td><?=$row['id'] ?></td>
				    <td><?=$row['date'] ?></td>
				    <td><?=$row['ipaddress'] ?></td>
					<td>
						<a class="" href="snoop.php?delete=<?php echo $row['id']; ?>"><i style="color: red; cursor: pointer; display: flex; justify-content: center; padding: 7px;" class="fa fa-trash"></i></a>
					</td>
				</tr>
			</tbody>
			<?php }?>
		</table>
	</div>
</div>

<?php include ('includes/footer.php');?>

</body>
</html>

